Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. ;; 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
  2. ;; we can just rely upon =, s j= to move a heading up if need be
  3. (defun my-org-insert-subheading (arg)
  4. "Insert a new subheading and demote it.
  5. Works for outline headings and for plain lists alike."
  6. (interactive "P")
  7. (evil-org-end-of-line) ;; go to end of line first
  8. (org-insert-heading arg)
  9. (cond
  10. ((org-at-heading-p) (org-do-demote))
  11. ((org-at-item-p) (org-indent-item))))
  12.  
  13. (defun my-org-insert-todo-subheading (arg)
  14. "Insert a new subheading with TODO keyword or checkbox and demote it.
  15. Works for outline headings and for plain lists alike."
  16. (interactive "P")
  17. (evil-org-end-of-line) ;; go to end of line first
  18. (org-insert-todo-heading arg)
  19. (cond
  20. ((org-at-heading-p) (org-do-demote))
  21. ((org-at-item-p) (org-indent-item))))
  22.  
  23. (spacemacs/set-leader-keys-for-major-mode 'org-mode "is" 'my-org-insert-subheading)
  24. (spacemacs/set-leader-keys-for-major-mode 'org-mode "iS" 'my-org-insert-todo-subheading)
  25. ;; introduce same parity for normal headings
  26. ;; "ih" is already working org-insert-heading
  27. (spacemacs/set-leader-keys-for-major-mode 'org-mode "ih" 'org-insert-heading-after-current)
  28. (spacemacs/set-leader-keys-for-major-mode 'org-mode "iH" 'evil-org-org-insert-todo-heading-respect-content-below)
Add Comment
Please, Sign In to add comment