aboutsummaryrefslogtreecommitdiff
path: root/emacs/init.el
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2016-11-17 10:44:56 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2016-11-17 10:44:56 +0100
commit8d79900bf3cc0145ccce8a612209c504d58a5eee (patch)
tree4b74b836268852740372f53e1e243f6f93c1d272 /emacs/init.el
parentf699df6b5ae3a103d74997556ccc8f4b5e334c4e (diff)
downloaddotfiles-8d79900bf3cc0145ccce8a612209c504d58a5eee.tar.gz
dotfiles-8d79900bf3cc0145ccce8a612209c504d58a5eee.zip
emacs: added expand-regiion
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs/init.el')
-rw-r--r--emacs/init.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/emacs/init.el b/emacs/init.el
index a050c55..f3dc9a7 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -519,6 +519,31 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(use-package which-key
:ensure t)
+; Even though this is not entirely needed because Evil already covers most of
+; it, sometimes it's convenient to use it.
+(use-package expand-region
+ :ensure t
+ :config
+
+ ; Set C-e as the expand command (mnemonic: expand). This command will
+ ; supercede the evil binding for "move one line", which I never use anyways.
+ (global-set-key (kbd "\C-e") 'er/expand-region)
+ (with-eval-after-load "evil"
+ '(progn
+ (define-key evil-normal-state-map (kbd "\C-e") 'er/expand-region)
+ (define-key evil-visual-state-map (kbd "\C-e") 'er/expand-region))))
+
+; Directly taken from: https://github.com/magnars/expand-region.el. This way we
+; can also expand the region into paragraphs and pages in text mode.
+(defun er/add-text-mode-expansions ()
+ (make-variable-buffer-local 'er/try-expand-list)
+ (setq er/try-expand-list (append
+ er/try-expand-list
+ '(mark-paragraph
+ mark-page))))
+
+(add-hook 'text-mode-hook 'er/add-text-mode-expansions)
+
;; TODO: dired evil
;; mu4e