lang/org: refactor tab/backtab/ret keybinds to be less intrusive

Turns out the native TAB/Backtab/RET functionality in org already does
what I've replaced them with (somewhat).

Also, I discovered that the canonical way to modify TAB behavior was
through org-tab-first-hook. So, instead of replacing native
functionality, I've rewritten these keybinds to leverage them.
This commit is contained in:
Henrik Lissner 2018-02-13 18:12:35 -05:00
parent a05c4cca6c
commit d84af58f77
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 46 additions and 53 deletions

View file

@ -207,12 +207,15 @@ unfold to point on startup."
(defun +org|setup-keybinds ()
"Sets up org-mode and evil keybindings. Tries to fix the idiosyncrasies
between the two."
(map! :map org-mode-map
"RET" #'org-return-indent
"C-c C-S-l" #'+org/remove-link
:n "C-c C-i" #'org-toggle-inline-images
(add-hook! 'org-tab-first-hook #'(+org|indent-maybe +org|yas-expand-maybe))
:n "RET" #'+org/dwim-at-point
(map! :map org-mode-map
[remap org-shifttab] #'+org/shifttab
"C-c C-S-l" #'+org/remove-link
"C-c C-i" #'org-toggle-inline-images
:i "RET" #'org-return-indent
:n "RET" #'+org/dwim-at-point
;; Navigate table cells (from insert-mode)
:i "C-l" #'+org/table-next-field
@ -225,9 +228,7 @@ between the two."
:ni "C-S-k" #'org-metaup
:ni "C-S-j" #'org-metadown
:n [tab] #'+org/toggle-fold
:i [tab] #'+org/indent-or-next-field-or-yas-expand
:i [backtab] #'+org/dedent-or-prev-field
:n [tab] #'+org/toggle-fold
:ni [M-return] (λ! (+org/insert-item 'below))
:ni [S-M-return] (λ! (+org/insert-item 'above))