From 5943855ab586bc8b726b89235e4732040de8d4c2 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 3 Oct 2012 02:50:41 +0200 Subject: [PATCH] .emacs.d/site-lisp/quick-edit-mode.el --- .emacs.d/site-lisp/quick-edit-mode.el | 43 +++++++++++++++++++-------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.emacs.d/site-lisp/quick-edit-mode.el b/.emacs.d/site-lisp/quick-edit-mode.el index effd30f..821c738 100644 --- a/.emacs.d/site-lisp/quick-edit-mode.el +++ b/.emacs.d/site-lisp/quick-edit-mode.el @@ -26,32 +26,49 @@ (defvar quick-edit-map (let ((map (make-sparse-keymap))) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) - (define-key map "f" 'forward-char) - (define-key map "b" 'backward-char) - (define-key map "e" 'oni:move-end-of-dwim) - (define-key map "a" 'oni:move-beginning-of-dwim) - (define-key map "V" 'scroll-down-command) - (define-key map "v" 'scroll-up-command) (define-key map "/" 'undo) - (define-key map "w" 'oni:kill-region-or-backward-char) - (define-key map "d" 'oni:kill-region-or-forward-char) - (define-key map "k" 'oni:kill-region-or-line) + (define-key map "0" 'delete-window) + (define-key map "1" 'delete-other-windows) + (define-key map "2" 'split-window-below) + (define-key map "3" 'split-window-right) (define-key map "K" 'kill-whole-line) + (define-key map "V" 'scroll-down-command) + (define-key map "a" 'oni:move-beginning-of-dwim) + (define-key map "b" 'backward-char) + (define-key map "d" 'oni:kill-region-or-forward-char) + (define-key map "e" 'oni:move-end-of-dwim) + (define-key map "f" 'forward-char) (define-key map "j" 'newline-and-indent) + (define-key map "k" 'oni:kill-region-or-line) + (define-key map "n" 'next-line) + (define-key map "o" 'other-window) + (define-key map "p" 'previous-line) + (define-key map "v" 'scroll-up-command) + (define-key map "w" 'oni:kill-region-or-backward-char) + (define-key map (kbd "C-b") 'electric-buffer-list) + (define-key map (kbd "C-g") 'quick-edit-mode) (define-key map (kbd "RET") 'quick-edit-mode) map) "Keymap for quick-edit-mode.") +(defun qe-locally-disable () + "Disable quick-edit mode in the minibuffer" + (when (eq overriding-local-map quick-edit-map) + (setq-local overriding-local-map nil))) + ;;;###autoload (define-minor-mode quick-edit-mode "Quickly edit stuff." :lighter " qe" :global t (if quick-edit-mode - (setq overriding-local-map quick-edit-map) - (setq overriding-local-map nil))) + (progn + (setq overriding-local-map quick-edit-map) + (add-hook 'minibuffer-setup-hook 'qe-locally-disable) + (add-hook 'special-mode-hook 'qe-locally-disable)) + (setq overriding-local-map nil) + (remove-hook 'minibuffer-setup-hook 'qe-locally-disable) + (remove-hook 'special-mode-hook 'qe-locally-disable))) (provide 'quick-edit-mode) ;;; quick-edit-mode.el ends here