Rethink how we standardize modified RET

C-RET / C-S-RET = add new "item" below/above
On MacOS
  s-RET / S-s-RET = add new line below/above
Elsewhere
  M-RET / M-S-RET = add new line below/above
This commit is contained in:
Henrik Lissner 2019-06-27 13:22:42 +02:00
parent 20b397362b
commit 2387f56ba1
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -184,8 +184,6 @@
:g "s-/" (λ! (save-excursion (comment-line 1))) :g "s-/" (λ! (save-excursion (comment-line 1)))
:n "s-/" #'evil-commentary-line :n "s-/" #'evil-commentary-line
:v "s-/" #'evil-commentary :v "s-/" #'evil-commentary
:gni [s-return] #'+default/newline-below
:gni [S-s-return] #'+default/newline-above
:gi [s-backspace] #'doom/backward-kill-to-bol-and-indent :gi [s-backspace] #'doom/backward-kill-to-bol-and-indent
:gi [s-left] #'doom/backward-to-bol-or-indent :gi [s-left] #'doom/backward-to-bol-or-indent
:gi [s-right] #'doom/forward-to-last-non-comment-or-eol :gi [s-right] #'doom/forward-to-last-non-comment-or-eol
@ -288,12 +286,19 @@
;; it will ignore comments+trailing whitespace before jumping to eol. ;; it will ignore comments+trailing whitespace before jumping to eol.
(map! :gi "C-a" #'doom/backward-to-bol-or-indent (map! :gi "C-a" #'doom/backward-to-bol-or-indent
:gi "C-e" #'doom/forward-to-last-non-comment-or-eol :gi "C-e" #'doom/forward-to-last-non-comment-or-eol
;; Standardize the behavior of M-RET/M-S-RET as a "add new item ;; Standardizes the behavior of modified RET to match the behavior of
;; below/above" key. ;; other editors, particularly Atom, textedit, textmate, and vscode, in
:gni [M-return] #'+default/newline-below ;; which ctrl+RET will add a new "item" below the current one and
:gni [M-S-return] #'+default/newline-above ;; cmd+RET (Mac) / meta+RET (elsewhere) will add a new, blank line below
;; the current one.
:gni [C-return] #'+default/newline-below :gni [C-return] #'+default/newline-below
:gni [C-S-return] #'+default/newline-above)) :gni [C-S-return] #'+default/newline-above
(:when IS-MAC
:gni [s-return] #'+default/newline-below
:gni [S-s-return] #'+default/newline-above)
(:unless IS-MAC
:gni [M-return] #'+default/newline-below
:gni [M-S-return] #'+default/newline-above)))
;; ;;