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)))
:n "s-/" #'evil-commentary-line
: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-left] #'doom/backward-to-bol-or-indent
:gi [s-right] #'doom/forward-to-last-non-comment-or-eol
@ -217,7 +215,7 @@
;; Unbind `help-for-help'. Conflicts with which-key's help command for the
;; <leader> h prefix. It's already on ? and F1 anyway.
"C-h" nil
"C-h" nil
;; replacement keybinds
;; replaces `info-emacs-manual' b/c it's on C-m now
@ -229,7 +227,7 @@
"re" #'doom/reload-env
;; replaces `apropos-documentation' b/c `apropos' covers this
"d" nil
"d" nil
"d/" #'doom/help-search
"da" #'doom/help-autodefs
"db" #'doom/report-bug
@ -288,12 +286,19 @@
;; it will ignore comments+trailing whitespace before jumping to eol.
(map! :gi "C-a" #'doom/backward-to-bol-or-indent
: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
;; below/above" key.
:gni [M-return] #'+default/newline-below
:gni [M-S-return] #'+default/newline-above
;; Standardizes the behavior of modified RET to match the behavior of
;; other editors, particularly Atom, textedit, textmate, and vscode, in
;; which ctrl+RET will add a new "item" below the current one and
;; cmd+RET (Mac) / meta+RET (elsewhere) will add a new, blank line below
;; the current one.
: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)))
;;