S-RET -> insert literal newline
A convention on many text editors and applications is to make RET auto-indent new lines. That has already been done. Another convention is for S-RET to insert an unindented line; this commit adds this convention to Doom. Relevant to #3694
This commit is contained in:
parent
9a5175dd0e
commit
863eb82efd
5 changed files with 19 additions and 8 deletions
|
@ -425,10 +425,6 @@
|
||||||
"M-=" #'doom/increase-font-size
|
"M-=" #'doom/increase-font-size
|
||||||
"M--" #'doom/decrease-font-size
|
"M--" #'doom/decrease-font-size
|
||||||
|
|
||||||
;;; newlines
|
|
||||||
[remap newline] #'newline-and-indent
|
|
||||||
"C-j" #'+default/newline
|
|
||||||
|
|
||||||
;;; search
|
;;; search
|
||||||
(:when (featurep! :completion ivy)
|
(:when (featurep! :completion ivy)
|
||||||
"C-S-s" #'swiper
|
"C-S-s" #'swiper
|
||||||
|
|
|
@ -50,10 +50,6 @@
|
||||||
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
|
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))
|
||||||
#'yas-insert-snippet)
|
#'yas-insert-snippet)
|
||||||
|
|
||||||
;; Smarter newlines
|
|
||||||
:i [remap newline] #'newline-and-indent ; auto-indent on newline
|
|
||||||
:i "C-j" #'+default/newline ; default behavior
|
|
||||||
|
|
||||||
(:after help :map help-mode-map
|
(:after help :map help-mode-map
|
||||||
:n "o" #'link-hint-open-link)
|
:n "o" #'link-hint-open-link)
|
||||||
(:after helpful :map helpful-mode-map
|
(:after helpful :map helpful-mode-map
|
||||||
|
|
|
@ -427,6 +427,13 @@ Continues comments if executed from a commented line. Consults
|
||||||
;; which ctrl+RET will add a new "item" below the current one and
|
;; 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
|
;; cmd+RET (Mac) / meta+RET (elsewhere) will add a new, blank line below
|
||||||
;; the current one.
|
;; the current one.
|
||||||
|
;; auto-indent on newline by default
|
||||||
|
:gi [remap newline] #'newline-and-indent
|
||||||
|
;; insert literal newline
|
||||||
|
:gi "S-RET" #'+default/newline
|
||||||
|
:gi [S-return] #'+default/newline
|
||||||
|
:gi "C-j" #'+default/newline
|
||||||
|
;; add new item below
|
||||||
:gn [C-return] #'+default/newline-below
|
:gn [C-return] #'+default/newline-below
|
||||||
:gn [C-S-return] #'+default/newline-above
|
:gn [C-S-return] #'+default/newline-above
|
||||||
(:when IS-MAC
|
(:when IS-MAC
|
||||||
|
|
|
@ -271,6 +271,15 @@ If on a:
|
||||||
(org-element-property :begin context)
|
(org-element-property :begin context)
|
||||||
(org-element-property :end context)))))))
|
(org-element-property :end context)))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org/shift-return (&optional arg)
|
||||||
|
"Insert a literal newline, or dwim in tables.
|
||||||
|
Executes `org-table-copy-down' if in table."
|
||||||
|
(interactive "p")
|
||||||
|
(if (org-at-table-p)
|
||||||
|
(org-table-copy-down arg)
|
||||||
|
(org-return nil arg)))
|
||||||
|
|
||||||
|
|
||||||
;; I use these instead of `org-insert-item' or `org-insert-heading' because they
|
;; I use these instead of `org-insert-item' or `org-insert-heading' because they
|
||||||
;; impose bizarre whitespace rules depending on cursor location and many
|
;; impose bizarre whitespace rules depending on cursor location and many
|
||||||
|
|
|
@ -643,6 +643,7 @@ between the two."
|
||||||
"C-c C-S-l" #'+org/remove-link
|
"C-c C-S-l" #'+org/remove-link
|
||||||
"C-c C-i" #'org-toggle-inline-images
|
"C-c C-i" #'org-toggle-inline-images
|
||||||
;; textmate-esque newline insertion
|
;; textmate-esque newline insertion
|
||||||
|
"S-RET" #'+org/shift-return
|
||||||
"C-RET" #'+org/insert-item-below
|
"C-RET" #'+org/insert-item-below
|
||||||
"C-S-RET" #'+org/insert-item-above
|
"C-S-RET" #'+org/insert-item-above
|
||||||
"C-M-RET" #'org-insert-subheading
|
"C-M-RET" #'org-insert-subheading
|
||||||
|
@ -999,6 +1000,8 @@ compelling reason, so..."
|
||||||
;; more intuitive RET keybinds
|
;; more intuitive RET keybinds
|
||||||
:i [return] (cmd! (org-return t))
|
:i [return] (cmd! (org-return t))
|
||||||
:i "RET" (cmd! (org-return t))
|
:i "RET" (cmd! (org-return t))
|
||||||
|
:i [S-return] #'+org/shift-return
|
||||||
|
:i "S-RET" #'+org/shift-return
|
||||||
:n [return] #'+org/dwim-at-point
|
:n [return] #'+org/dwim-at-point
|
||||||
:n "RET" #'+org/dwim-at-point
|
:n "RET" #'+org/dwim-at-point
|
||||||
;; more vim-esque org motion keys (not covered by evil-org-mode)
|
;; more vim-esque org motion keys (not covered by evil-org-mode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue