Use move-text to allow moving up or down of the selected region as well

This commit is contained in:
Bozhidar Batsov 2013-09-17 13:24:03 +03:00
parent c0727a8404
commit 121ad02843
4 changed files with 7 additions and 22 deletions

View file

@ -222,8 +222,8 @@ Keybinding | Description
<kbd>C-c y</kbd> | Search in YouTube for the thing under point (or an interactive query).
<kbd>C-S-RET</kbd> or <kbd>M-o</kbd> | Insert an empty line above the current line and indent it properly
<kbd>S-RET</kbd> or <kbd>M-O</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-down</kbd> | Move the current line down.
<kbd>C-S-up</kbd> or <kbd>M-S-up</kbd> | Move the current line or region up.
<kbd>C-S-down</kbd> or <kbd>M-S-down</kbd>| Move the current line or region down.
<kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace.
<kbd>C-c f</kbd> | Open recently visited file.
<kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer.

View file

@ -123,21 +123,6 @@ With a prefix ARG open line above the current line."
(interactive)
(delete-indentation 1))
(defun prelude-move-line-up ()
"Move the current line up."
(interactive)
(transpose-lines 1)
(forward-line -2)
(indent-according-to-mode))
(defun prelude-move-line-down ()
"Move the current line down."
(interactive)
(forward-line 1)
(transpose-lines 1)
(forward-line -1)
(indent-according-to-mode))
(defun prelude-kill-whole-line (&optional arg)
"A simple wrapper around command `kill-whole-line' that respects indentation.
Passes ARG to command `kill-whole-line' when provided."

View file

@ -43,10 +43,10 @@
(define-key map [(shift return)] 'prelude-smart-open-line)
(define-key map (kbd "M-o") '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 [(meta shift up)] 'prelude-move-line-up)
(define-key map [(meta shift down)] 'prelude-move-line-down)
(define-key map [(control shift up)] 'move-text-up)
(define-key map [(control shift down)] 'move-text-down)
(define-key map [(meta shift up)] 'move-text-up)
(define-key map [(meta shift down)] 'move-text-down)
(define-key map (kbd "C-c n") 'prelude-cleanup-buffer)
(define-key map (kbd "C-c f") 'prelude-recentf-ido-find-file)
(define-key map (kbd "C-M-\\") 'prelude-indent-region-or-buffer)

View file

@ -45,7 +45,7 @@
expand-region flx-ido flycheck gist
git-commit-mode gitconfig-mode gitignore-mode grizzl
guru-mode helm helm-projectile ido-ubiquitous
key-chord magit rainbow-mode
key-chord magit move-text rainbow-mode
smartparens smex undo-tree
volatile-highlights zenburn-theme)
"A list of packages to ensure are installed at launch.")