Last active
July 18, 2018 04:02
-
-
Save codygman/13f9fe1aaf2e106268a6bf38b1fcb1e3 to your computer and use it in GitHub Desktop.
fixed evil insert subheading/insert subheading todo and use more sane (for me) keybinds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; not the first iteration, but since =, i h= and =, i s= didn't work and inserting a subitem above doesn't make sense I made the capitalized versions insert a todo | |
;; we can just rely upon =, s j= to move a heading up if need be | |
(defun my-org-insert-subheading (arg) | |
"Insert a new subheading and demote it. | |
Works for outline headings and for plain lists alike." | |
(interactive "P") | |
(evil-org-end-of-line) ;; go to end of line first | |
(org-insert-heading arg) | |
(cond | |
((org-at-heading-p) (org-do-demote)) | |
((org-at-item-p) (org-indent-item)))) | |
(defun my-org-insert-todo-subheading (arg) | |
"Insert a new subheading with TODO keyword or checkbox and demote it. | |
Works for outline headings and for plain lists alike." | |
(interactive "P") | |
(evil-org-end-of-line) ;; go to end of line first | |
(org-insert-todo-heading arg) | |
(cond | |
((org-at-heading-p) (org-do-demote)) | |
((org-at-item-p) (org-indent-item)))) | |
(spacemacs/set-leader-keys-for-major-mode 'org-mode "is" 'my-org-insert-subheading) | |
(spacemacs/set-leader-keys-for-major-mode 'org-mode "iS" 'my-org-insert-todo-subheading) | |
;; introduce same parity for normal headings | |
;; "ih" is already working org-insert-heading | |
(spacemacs/set-leader-keys-for-major-mode 'org-mode "ih" 'org-insert-heading-after-current) | |
(spacemacs/set-leader-keys-for-major-mode 'org-mode "iH" 'evil-org-org-insert-todo-heading-respect-content-below) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment