diff --git a/README.md b/README.md index 7a919e5..0466e02 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ Keybinding | Description -------------------|------------------------------------------------------------ C-c o | Open the currently visited file with an external program. C-c g | Search in Google for the thing under point (or an interactive query). +C-S-RET | Insert an empty line above the current line and indent it properly S-RET | Insert an empty line and indent it properly (as in most IDEs). C-S-up | Move the current line up. C-S-down | Move the current line down. diff --git a/core/prelude-core.el b/core/prelude-core.el index b0f2b90..2a2da0b 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -79,6 +79,15 @@ (indent-rigidly (point-min) (point-max) arg) (clipboard-kill-ring-save (point-min) (point-max))))) +(defun prelude-smart-open-line-above () + "Insert an empty line above the current line. +Position the cursor at it's beginning, according to the current mode" + (interactive) + (beginning-of-line) + (newline) + (forward-line -1) + (indent-according-to-mode)) + (defun prelude-smart-open-line () "Insert an empty line after the current line. Position the cursor at its beginning, according to the current mode." diff --git a/core/prelude-mode.el b/core/prelude-mode.el index 17aa6fb..f99a010 100644 --- a/core/prelude-mode.el +++ b/core/prelude-mode.el @@ -39,6 +39,7 @@ (define-key map (kbd "C-c g") 'prelude-google) ;; mimic popular IDEs binding, note that it doesn't work in a terminal session (define-key map [(shift return)] 'prelude-smart-open-line) + (define-key map [(control shift return)] 'prelude-smart-open-line-above) (define-key map [(control shift up)] 'prelude-move-line-up) (define-key map [(control shift down)] 'prelude-move-line-down) (define-key map (kbd "C-c n") 'prelude-cleanup-buffer)