From 121ad02843ee606fde0615297bfe803a1c33d99a Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Tue, 17 Sep 2013 13:24:03 +0300 Subject: [PATCH] Use move-text to allow moving up or down of the selected region as well --- README.md | 4 ++-- core/prelude-core.el | 15 --------------- core/prelude-mode.el | 8 ++++---- core/prelude-packages.el | 2 +- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9d068cd..805cc4a 100644 --- a/README.md +++ b/README.md @@ -222,8 +222,8 @@ Keybinding | Description C-c y | Search in YouTube for the thing under point (or an interactive query). C-S-RET or M-o | Insert an empty line above the current line and indent it properly S-RET or M-O | 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. +C-S-up or M-S-up | Move the current line or region up. +C-S-down or M-S-down| Move the current line or region down. C-c n | Fix indentation in buffer and strip whitespace. C-c f | Open recently visited file. C-M-\\ | Indent region (if selected) or the entire buffer. diff --git a/core/prelude-core.el b/core/prelude-core.el index 02fe3d4..d622514 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -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." diff --git a/core/prelude-mode.el b/core/prelude-mode.el index 886b502..9ef3fea 100644 --- a/core/prelude-mode.el +++ b/core/prelude-mode.el @@ -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) diff --git a/core/prelude-packages.el b/core/prelude-packages.el index 7659b60..e462144 100644 --- a/core/prelude-packages.el +++ b/core/prelude-packages.el @@ -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.")