α define first hydras for refiling and moving

(I am not 100% on these; there is some overlap with speed commands)
master
Jacopo De Simoi 4 years ago
parent 2079516707
commit cd6599799a
  1. 32
      global.org

@ -1243,6 +1243,38 @@
(org-timestamp-down-day 7)
(hydra-timestamp/hl-paren-force-fix)) "-1W")))
#+end_src
*** Hydras for refiling
This bit evolved from [[https://www.mollermara.com/blog/Fast-refiling-in-org-mode-with-hydras/][this post]]; see more at [[https://gist.github.com/mm--/60e0790bcbf8447160cc87a66dc949ab ][this gist]].
#+begin_src emacs-lisp
(defun wilder/refile (file headline &optional arg)
(let ((pos (save-excursion
(find-file file)
(org-find-exact-headline-in-buffer headline))))
(org-refile arg nil (list headline file nil pos)))
(switch-to-buffer (current-buffer)))
#+end_src
#+begin_src emacs-lisp
(defhydra wilder/hydra-org-refile (:foreign-keys run)
"Refile"
("g" (wilder/refile "hack.org" "emacs") "Refile to Hack-emacs")
("q" nil "cancel"))
(define-key org-mode-map (kbd "C-x \\") 'wilder/hydra-org-refile/body)
#+end_src
*** Hydras for moving headlines around
#+begin_src emacs-lisp
(defhydra wilder/hydra-org-move ()
"Move subtree"
("f" org-backward-heading-same-level "move up" :column "Movement")
("s" org-forward-heading-same-level "move down")
("r" outline-up-heading "level down")
("n" org-promote-subtree "promote" :column "Bubbling")
("l" org-demote-subtree "demote")
("i" org-move-subtree-up "bubble up")
("e" org-move-subtree-down "bubble down")
("q" nil "cancel"))
(define-key org-mode-map (kbd "C-x SPC") 'wilder/hydra-org-move/body)
#+end_src
*** Capture
Set default keybinding
#+begin_src emacs-lisp

Loading…
Cancel
Save