diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2016-07-04 12:14:36 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2016-07-04 12:14:36 +0200 |
| commit | ad38c0b697617a2b246c7bc83cfb47afb33de10f (patch) | |
| tree | 05b80665260cf0da582e1752c02fb56f22369127 /emacs | |
| parent | dee5d71426ea9982996e84d0015264f9830815c6 (diff) | |
| download | dotfiles-ad38c0b697617a2b246c7bc83cfb47afb33de10f.tar.gz dotfiles-ad38c0b697617a2b246c7bc83cfb47afb33de10f.zip | |
emacs: make [escape] quit any situation
Moreover, I'm also adding some minor misc. improvements
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/init.el | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/emacs/init.el b/emacs/init.el index 32e4e5e..0c41713 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -262,6 +262,32 @@ (define-key evil-normal-state-map (kbd "C-p") 'helm-projectile-find-file) (define-key evil-normal-state-map (kbd "M-p") 'helm-projectile-switch-project) + ; I use the Super key in combination with j & k to move around i3. Let's unset + ; M- combos for these two fellows for whenever I misstype them. + (global-unset-key (kbd "M-j")) + (global-unset-key (kbd "M-k")) + + ; both this function and the subsequent lines about [escape] are taken from + ; @aaronbieber configuration. + (defun minibuffer-keyboard-quit () + "Abort recursive edit. +In Delete Selection mode, if the mark is active, just deactivate it; +then it takes a second \\[keyboard-quit] to abort the minibuffer." + (interactive) + (if (and delete-selection-mode transient-mark-mode mark-active) + (setq deactivate-mark t) + (when (get-buffer "*Completions*") (delete-windows-on "*Completions*")) + (abort-recursive-edit))) + + ;; Make escape quit everything, whenever possible. + (define-key evil-normal-state-map [escape] 'keyboard-quit) + (define-key evil-visual-state-map [escape] 'keyboard-quit) + (define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit) + (define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit) + (define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit) + (define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit) + (define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit) + ; I store macros on the <q> register for convenience, so let's also use the ; <C-q> combo to execute the macro. ; TODO: not really working @@ -286,7 +312,8 @@ (set-quit-char "C-z") ;; Use insert mode by default on the following modes. - (dolist (mode '(twittering-edit-mode)) + (dolist (mode '(twittering-edit-mode + magit-log-edit-mode)) (add-to-list 'evil-insert-state-modes mode)) (use-package evil-leader |
