Skip to content

Latest commit

 

History

History
63 lines (57 loc) · 1.77 KB

old-snippets.org

File metadata and controls

63 lines (57 loc) · 1.77 KB

Old-snippets

This is a place where old snippets go after they’ve served their time in my config. This is so others can find them and I don’t have to hunt too hard.

Helm

(map! :after helm-files
      :map helm-find-files-map
      ;; "C-h" #'helm-find-files-up-one-level
      ;; "C-l" #'helm-ff-RET)
      ("<C-backspace>" #'helm-find-files-up-one-level))

(map! :after helm
      :map helm-map
      ([tab] #'helm-execute-if-single-persistent-action)
      ("C-i" #'helm-execute-persistent-action))

;;;###autoload
(defun double-flash-mode-line ()
  "Flash the modeline"
 (let ((flash-sec (/ 1.0 20)))
   (invert-face 'mode-line)
   (run-with-timer flash-sec nil #'invert-face 'mode-line)
   (run-with-timer (* 2 flash-sec) nil #'invert-face 'mode-line)
   (run-with-timer (* 3 flash-sec) nil #'invert-face 'mode-line)))

;;;###autoload
(defun helm-execute-if-single-persistent-action (&optional attr split-onewindow)
 "Execute persistent action if the candidate list is less than 2"
 (interactive)
 (with-helm-alive-p
   (if (> (helm-get-candidate-number) 2)
       (double-flash-mode-line)
     (helm-execute-persistent-action))))

org

Add o/O to add new list item

(add-to-list 'evil-org-special-o/O 'item)

ein

(after! ein
  (setq :ein-notebook-dir "/home/emiller/src/fg/")

  (map! :map ein:notebook-mode-map
        :localleader
        "," #'+ein-hydra/body))

Reformatter

(use-package! reformatter
  :config
  (defconst Rscript-command "Rscript")
  (reformatter-define styler
    :program Rscript-command
    :args (list "--vanilla" "-e" "con <- file(\"stdin\")
out <- styler::style_text(readLines(con))
close(con)
out")
    :lighter " styler"))