summaryrefslogtreecommitdiffstats
path: root/.emacs.d/site-lisp
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-09-25 10:01:12 +0200
committerGravatar Tom Willemsen2012-09-25 10:01:12 +0200
commit14d2e1e1f27031db71f003fa53d9b18af0c6fc8d (patch)
treedf7a6dd52f53a00946394deb50264496f326a1ff /.emacs.d/site-lisp
parenta5d4bf52f171fcfe2bc48964a18a2003e8945102 (diff)
downloaddotfiles-14d2e1e1f27031db71f003fa53d9b18af0c6fc8d.tar.gz
dotfiles-14d2e1e1f27031db71f003fa53d9b18af0c6fc8d.zip
.emacs.d/site-lisp/quick-edit-mode.el
Diffstat (limited to '.emacs.d/site-lisp')
-rw-r--r--.emacs.d/site-lisp/quick-edit-mode.el56
1 files changed, 56 insertions, 0 deletions
diff --git a/.emacs.d/site-lisp/quick-edit-mode.el b/.emacs.d/site-lisp/quick-edit-mode.el
new file mode 100644
index 0000000..5ba8b72
--- /dev/null
+++ b/.emacs.d/site-lisp/quick-edit-mode.el
@@ -0,0 +1,56 @@
+;;; quick-edit-mode.el --- Quickly edit stuff
+
+;; Copyright (C) 2012 Tom Willemsen
+
+;; Author: Tom Willemsen <slash@drd>
+;; Keywords: convenience
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Quickly edit stuff
+
+;;; Code:
+
+(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 "K" 'kill-whole-line)
+ (define-key map (kbd "RET") 'quick-edit-mode)
+ map)
+ "Keymap for quick-edit-mode.")
+
+;;;###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)))
+
+(provide 'quick-edit-mode)
+;;; quick-edit-mode.el ends here