;-*- coding: utf-8 -*- ;; ergonomic_keybinding_dvorak.el -- A ergonomic keybinding for Dvorak keyboard. ;; Copyright © 2007 Xah Lee ;; Author: Xah Lee (http://xahlee.org/) ;; Keywords: qwerty, dvorak, keybinding, ergonomic ;; You can redistribute this program and/or modify it under the terms ;; of the GNU General Public License as published by the Free Software ;; Foundation; either version 2, or (at your option) any later ;; version. ;;; Commentary: ;; This keybinding puts the most frequently used emacs shortcuts into ;; the most easier to type spots, and, using the Meta-«key» space only. ;; For detail on the design of this keybinding and a visual layout, ;; and versions for Dvorak or Qwerty keyboards, see: ;; http://xahlee.org/emacs/ergonomic_emacs_keybinding.html ;;; History: ;; version 1.1, 2007-12-18. changed keycode to consistantly use kbd syntax ;; version 1.0, 2007-08-01. first version. ;;; Install: ;; Place this file in your favoritate directory, such as ;; ~/emacs/ergonomic_keybinding_dvorak.el ;; Then, place the following code in your emacs init file (~/.emacs): ;; (load-file "~/emacs/ergonomic_keybinding_dvorak.el") ;;; Code: ;;; CURSOR MOVEMENTS ;; Single char cursor movement (global-set-key (kbd "M-h") 'backward-char) ; was mark-paragraph (global-set-key (kbd "M-n") 'forward-char) ; was none (global-set-key (kbd "M-c") 'previous-line) ; was capitalize-word (global-set-key (kbd "M-t") 'next-line) ; was transpose-words ;; Move by word (global-set-key (kbd "M-g") 'backward-word) ; was (prefix) (global-set-key (kbd "M-r") 'forward-word) ; was move-to-window-line ;; Move by paragraph (global-set-key (kbd "M-G") 'backward-paragraph) ; was none (global-set-key (kbd "M-R") 'forward-paragraph) ; was none ;; Move to beginning/ending of line (global-set-key (kbd "M-d") 'move-beginning-of-line) ; was kill-word (global-set-key (kbd "M-D") 'move-end-of-line) ; was none ;; Move by screen (page up/down) (global-set-key (kbd "M-T") 'scroll-up) ; was none (global-set-key (kbd "M-C") 'scroll-down) ; was none ;; Move to beginning/ending of file (global-set-key (kbd "M-H") 'beginning-of-buffer) ; was none (global-set-key (kbd "M-N") 'end-of-buffer) ; was none ;; Switch window (emacs's “frame”) (global-set-key (kbd "M-`") 'other-frame) ; was tmm-menubar. (OS X convention) (global-set-key (kbd "M-l") 'recenter) ; was downcase-word ;;; MAJOR EDITING COMMANDS ;; Delete previous/next char. (with Backspace, or shift Backspace) (global-set-key (kbd "") 'delete-char) ; was none ; Delete previous/next word. (meta Backspace and meta shift Backspace) (global-set-key (kbd "") 'kill-word) ; was none ; Copy Cut Paste, Paste previous (global-set-key (kbd "M-,") 'kill-region) ; was tags-loop-continue (global-set-key (kbd "M-.") 'kill-ring-save) ; was find-tag (global-set-key (kbd "M-p") 'yank) ; was none (global-set-key (kbd "M-P") 'yank-pop) ; was none ; Undo (global-set-key (kbd "M-e") 'undo) ; was forward-sentence ; Kill line (global-set-key (kbd "M-u") 'kill-line) ; was upcase-word ;;; Textual Transformation (global-set-key (kbd "M-S-SPC") 'mark-paragraph) ; was none ;;; EMACS'S SPECIAL COMMANDS ; Mark point. (global-set-key (kbd "M-SPC") 'set-mark-command) ; was just-one-space (global-set-key (kbd "M-a") 'execute-extended-command) ; was backward-sentence ;;; WINDOW SPLITING (global-set-key (kbd "M-2") 'split-window-vertically) ; was digit-argument (global-set-key (kbd "M-1") 'delete-other-windows) ; was digit-argument (global-set-key (kbd "M-0") 'delete-window) ; was digit-argument (global-set-key (kbd "M-o") 'other-window) ; was prefix ;;; OPTIONAL ;; (global-set-key (kbd "M-s") 'isearch-forward) ;; (global-set-key (kbd "M-S") 'isearch-backward) ;; (add-hook 'isearch-mode-hook ;; (lambda () ;; (define-key isearch-mode-map (kbd "M-s") 'isearch-repeat-forward) ;; (define-key isearch-mode-map (kbd "M-S") 'isearch-repeat-backward) ;; (define-key isearch-mode-map (kbd "1") 'isearch-printing-char) ;; ) ;; ) ;; ;; fix binding for shell and shell-command ;; (add-hook 'comint-mode-hook ;; (lambda () ;; (define-key comint-mode-map (kbd "M-p") 'yank) ;; (define-key comint-mode-map (kbd "M-r") 'forward-word) ;; (define-key comint-mode-map (kbd "M-s") 'isearch-forward) ;; ))