summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-ergodox-mode.el
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2015-10-23 18:57:59 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2015-10-23 18:57:59 (GMT)
commitcd1924466152177ea06b17c843f256463c1b91b8 (patch)
treeaf90afe028e5e392f242a3ea36302aafe1c1769d /lisp/ravi-ergodox-mode.el
parent5561df232cfa49822f322196d98170f95aa1139e (diff)
parent74c319ef12dd3130f6afc17abc59404b59d601d1 (diff)
downloaddotemacs-cd1924466152177ea06b17c843f256463c1b91b8.zip
dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.gz
dotemacs-cd1924466152177ea06b17c843f256463c1b91b8.tar.bz2
Merge branch 'master' into rtags-attempt
* master: (139 commits) Add pdf-tools as a nicer replacement for doc-view Add pdf-tools submodule Fix maildir data with correct path Add desktop notifications for email Potential use for modes without repls Attach files more easily in mu Update to newest version of mu Please remove tooltips after a while, please ace-window gets confused when tooltips are present Sometimes the dispatch list does come in handy Pre-populate searches Succumb to muscle memory of control keys Remove ropemacs due to disuse Do not let company-quickhelp steal a global key Manage word navigation Use proper helm function to replace completing-read Electric operators on python mode Use which-key in preference to guide-key Navigate easier Simplify config with magit 2.1.0 ...
Diffstat (limited to 'lisp/ravi-ergodox-mode.el')
-rw-r--r--lisp/ravi-ergodox-mode.el83
1 files changed, 83 insertions, 0 deletions
diff --git a/lisp/ravi-ergodox-mode.el b/lisp/ravi-ergodox-mode.el
new file mode 100644
index 0000000..a4867be
--- /dev/null
+++ b/lisp/ravi-ergodox-mode.el
@@ -0,0 +1,83 @@
+;;; ravi-ergodox-mode.el --- Keybindings fof Ergodox keyboard
+
+;; Copyright (C) 2014 Ravikiran Rajagopal
+
+;; Author: Ravikiran Rajagopal <ravi@nero.lan>
+;; Keywords: convenience, hardware
+
+;; 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:
+
+;; Set up keymap for ergodox bindings
+
+;;; Code:
+
+(defgroup ravi-ergodox-mode nil
+ "Keybindings for ergodox."
+ :group 'ravi-ergodox-mode)
+
+(defvar ravi-ergodox-mode-map (make-sparse-keymap)
+ "Keymaps for command `ravi-ergodox-mode-map'.")
+
+(defcustom ravi-ergodox-mode-disable-predicates nil
+ "List of predicates that disable the mode.
+Each function in the list receive no argument."
+ :group 'ravi-ergodox-mode)
+
+(defcustom ravi-ergodox-mode-disabled-modes nil
+ "Modes where `ravi-ergodox-mode' should not activate."
+ :group 'ravi-ergodox-mode
+ :type '(repeat symbol))
+
+(define-minor-mode ravi-ergodox-mode
+ "Enable Ergodox keyboard special bindings."
+ :lighter " RE" :group 'convenience
+ :keymap ravi-ergodox-mode-map
+ :global t
+ (if ravi-ergodox-mode
+ (progn
+ (setq x-meta-keysym 'super)
+ (setq x-super-keysym 'meta))
+ (progn
+ (setq x-meta-keysym nil)
+ (setq x-super-keysym nil))
+ )
+ )
+
+(define-key ravi-ergodox-mode-map (kbd "H-m") 'magit-status)
+(define-key ravi-ergodox-mode-map (kbd "<f6>") 'ff-find-other-file)
+(if (and (boundp 'ravi/use-helm-instead-of-ido) ravi/use-helm-instead-of-ido)
+ (progn
+ (define-key ravi-ergodox-mode-map (kbd "<f1>") 'helm-multi-files)
+ (define-key ravi-ergodox-mode-map (kbd "<f2>") 'helm-find-files))
+ (progn
+ (define-key ravi-ergodox-mode-map (kbd "<f1>") 'ido-switch-buffer)
+ (define-key ravi-ergodox-mode-map (kbd "<f2>") 'ido-find-file)))
+
+(defun ravi-ergodox-mode-enable ()
+ "Turn on ergodox bindings mode."
+ (and (not (memq major-mode ravi-ergodox-mode-disabled-modes))
+ (not (catch 'disable
+ (dolist (pred ravi-ergodox-mode-disable-predicates)
+ (and (funcall pred)
+ (throw 'disable t)))))
+ (ravi-ergodox-mode 1)))
+
+(defun ravi-ergodox-mode-disable ()
+ "Turn off ergodox bindings mode."
+ (ravi-ergodox-mode -1))
+
+(provide 'ravi-ergodox-mode)
+;;; ravi-ergodox-mode.el ends here