What the .emacs.d!?

Opening new lines can be finicky.


(defun open-line-below ()
  (interactive)
  (end-of-line)
  (newline)
  (indent-for-tab-command))

(defun open-line-above ()
  (interactive)
  (beginning-of-line)
  (newline)
  (forward-line -1)
  (indent-for-tab-command))

(global-set-key (kbd "<C-return>") 'open-line-below)
(global-set-key (kbd "<C-S-return>") 'open-line-above)

With these shortcuts you can open a new line above or below the current one, even if the cursor is midsentence.

Try it out, it's a nice convenience.

blog comments powered by Disqus