Browse Source

Merge pull request #291 from Abizern/add-to-prelude-core

Add to prelude core
custom
Bozhidar Batsov 13 years ago
parent
commit
aed6e3b253
  1. 1
      README.md
  2. 11
      core/prelude-core.el
  3. 1
      core/prelude-mode.el

1
README.md

@ -209,6 +209,7 @@ Keybinding | Description
-------------------|------------------------------------------------------------ -------------------|------------------------------------------------------------
<kbd>C-c o</kbd> | Open the currently visited file with an external program. <kbd>C-c o</kbd> | Open the currently visited file with an external program.
<kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query). <kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query).
<kbd>C-S-RET</kbd> | Insert an empty line above the current line and indent it properly
<kbd>S-RET</kbd> | Insert an empty line and indent it properly (as in most IDEs). <kbd>S-RET</kbd> | Insert an empty line and indent it properly (as in most IDEs).
<kbd>C-S-up</kbd> | Move the current line up. <kbd>C-S-up</kbd> | Move the current line up.
<kbd>C-S-down</kbd> | Move the current line down. <kbd>C-S-down</kbd> | Move the current line down.

11
core/prelude-core.el

@ -79,6 +79,13 @@
(indent-rigidly (point-min) (point-max) arg) (indent-rigidly (point-min) (point-max) arg)
(clipboard-kill-ring-save (point-min) (point-max))))) (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)
(previous-line)
(prelude-smart-open-line))
(defun prelude-smart-open-line () (defun prelude-smart-open-line ()
"Insert an empty line after the current line. "Insert an empty line after the current line.
Position the cursor at its beginning, according to the current mode." Position the cursor at its beginning, according to the current mode."
@ -87,13 +94,13 @@ Position the cursor at its beginning, according to the current mode."
(newline-and-indent)) (newline-and-indent))
(defun prelude-move-line-up () (defun prelude-move-line-up ()
"Move up the current line."
"Move the current line up."
(interactive) (interactive)
(transpose-lines 1) (transpose-lines 1)
(forward-line -2)) (forward-line -2))
(defun prelude-move-line-down () (defun prelude-move-line-down ()
"Move down the current line."
"Move the current line down."
(interactive) (interactive)
(forward-line 1) (forward-line 1)
(transpose-lines 1) (transpose-lines 1)

1
core/prelude-mode.el

@ -39,6 +39,7 @@
(define-key map (kbd "C-c g") 'prelude-google) (define-key map (kbd "C-c g") 'prelude-google)
;; mimic popular IDEs binding, note that it doesn't work in a terminal session ;; 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 [(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 up)] 'prelude-move-line-up)
(define-key map [(control shift down)] 'prelude-move-line-down) (define-key map [(control shift down)] 'prelude-move-line-down)
(define-key map (kbd "C-c n") 'prelude-cleanup-buffer) (define-key map (kbd "C-c n") 'prelude-cleanup-buffer)

Loading…
Cancel
Save