lang/org: make TAB keybind dwim; including yas-expand
This commit is contained in:
parent
335d9c27a9
commit
5402521647
2 changed files with 12 additions and 4 deletions
|
@ -26,10 +26,18 @@
|
|||
(t (call-interactively 'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/indent-or-next-field ()
|
||||
"Depending on the context either indent the current item or go the next table field."
|
||||
(defun +org/indent-or-next-field-or-yas-expand ()
|
||||
"Depending on the context either a) indent the current line, b) go the next
|
||||
table field or c) run `yas-expand'."
|
||||
(interactive)
|
||||
(call-interactively (if (org-at-table-p) 'org-table-next-field '+org/indent)))
|
||||
(call-interactively
|
||||
(cond ((and (bound-and-true-p yas-minor-mode)
|
||||
(yas--templates-for-key-at-point))
|
||||
'yas-expand)
|
||||
((org-at-table-p)
|
||||
'org-table-next-field)
|
||||
(t
|
||||
'+org/indent))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/dedent ()
|
||||
|
|
|
@ -239,7 +239,7 @@
|
|||
:i "C-e" 'org-end-of-line
|
||||
:i "C-a" 'org-beginning-of-line
|
||||
|
||||
:i "<tab>" '+org/indent-or-next-field
|
||||
:i "<tab>" '+org/indent-or-next-field-or-yas-expand
|
||||
:i [S-iso-lefttab] '+org/dedent-or-prev-field ; for GNU Emacs
|
||||
:i [(shift tab)] '+org/dedent-or-prev-field
|
||||
:i [backtab] '+org/dedent-or-prev-field
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue