3 ms·
From my customizations, these are the most I use: Pressing Return starts a new line at column 0, pressing Control j starts a new indented line. I prefer them t
by tspiteri 16y ago
From my customizations, these are the most I use:
Pressing Return starts a new line at column 0, pressing Control j starts a new indented line. I prefer them the other way round, so I rebind:
(global-set-key "\r" 'newline-and-indent)
(global-set-key "\C-j" 'newline)
Also, very often I need to start a new line above or below the current line. So instead of Control e, Return to start a new indented line below the current line I use Control Return.
(defun next-newline-and-indent ()
(interactive)
(end-of-line)
(newline-and-indent))
(global-set-key [C-return] 'next-newline-and-indent)
And to start a new indented line above the current line, instead of Control a, Control o, Control i, I use Control Shift Return.
(defun prev-newline-and-indent ()
(interactive)
(beginning-of-line)
(open-line 1)
(indent-according-to-mode))
(global-set-key [C-S-return] 'prev-newline-and-indent)