Merge branch 'master' of github.com:bbatsov/prelude

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
This commit is contained in:
Bozhidar Batsov 2013-04-02 12:14:31 +03:00
commit 1e10d763f3
3 changed files with 16 additions and 7 deletions

View file

@ -187,7 +187,7 @@ extensions to keybindings.
Keybinding | Description Keybinding | Description
-------------------|------------------------------------------------------------ -------------------|------------------------------------------------------------
<kbd>C-M-h</kbd> | Kill the previous word(`backward-kill-word`). (as in Bash/Zsh) <kbd>C-M-h</kbd> | Kill the previous word(`backward-kill-word`). (as in Bash/Zsh)
<kbd>C-x \</kbd> | `align-regexp` <kbd>C-x \\</kbd> | `align-regexp`
<kbd>C-+</kbd> | Increase font size(`text-scale-increase`). <kbd>C-+</kbd> | Increase font size(`text-scale-increase`).
<kbd>C--</kbd> | Decrease font size(`text-scale-decrease`). <kbd>C--</kbd> | Decrease font size(`text-scale-decrease`).
<kbd>C-x O</kbd> | Go back to previous window (the inverse of `other-window` (`C-x o`)). <kbd>C-x O</kbd> | Go back to previous window (the inverse of `other-window` (`C-x o`)).
@ -197,7 +197,7 @@ Keybinding | Description
<kbd>C-x M-m</kbd> | Start your default shell. <kbd>C-x M-m</kbd> | Start your default shell.
<kbd>C-x C-m</kbd> | Alias for `M-x`. <kbd>C-x C-m</kbd> | Alias for `M-x`.
<kbd>C-h A</kbd> | Run `apropos` (search in all Emacs symbols). <kbd>C-h A</kbd> | Run `apropos` (search in all Emacs symbols).
<kbd>M-\</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`). <kbd>M-\\</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`).
<kbd>C-x C-b</kbd> | Open `ibuffer` (a replacement for the default `buffer-list`). <kbd>C-x C-b</kbd> | Open `ibuffer` (a replacement for the default `buffer-list`).
<kbd>F12</kbd> | Toggle the Emacs menu bar. <kbd>F12</kbd> | Toggle the Emacs menu bar.
<kbd>C-x g</kbd> | Open Magit's status buffer. <kbd>C-x g</kbd> | Open Magit's status buffer.
@ -209,12 +209,13 @@ 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.
<kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace. <kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace.
<kbd>C-c f</kbd> | Open recently visitted file. <kbd>C-c f</kbd> | Open recently visited file.
<kbd>C-M-\</kbd> | Indent region (if selected) or the entire buffer. <kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer.
<kbd>C-c u</kbd> | Open URL in your default browser. <kbd>C-c u</kbd> | Open URL in your default browser.
<kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result. <kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result.
<kbd>C-c s</kbd> | Swap two active windows. <kbd>C-c s</kbd> | Swap two active windows.
@ -226,7 +227,7 @@ Keybinding | Description
#### Projectile #### Projectile
Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/prelude): Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/projectile):
Keybinding | Description Keybinding | Description
-------------------|------------------------------------------------------------ -------------------|------------------------------------------------------------

View file

@ -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,14 +94,14 @@ 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)
(indent-according-to-mode)) (indent-according-to-mode))
(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)

View file

@ -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 [(meta shift up)] 'prelude-move-line-up) (define-key map [(meta shift up)] 'prelude-move-line-up)