Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; http://www.reddit.com/r/emacs/comments/123lbu/there_must_be_a_better_way_to_switch_between/c6rzl48
- ;; As of this writing, emacs does not correctly recognize some xterm
- ;; key sequences. Add code to deal with these.
- (defun add-escape-key-mapping-alist (escape-prefix key-prefix
- suffix-alist)
- "Add mappings for up, down, left and right keys for a given list
- of escape sequences and list of keys."
- (while suffix-alist
- (let ((escape-suffix (car (car suffix-alist)))
- (key-suffix (cdr (car suffix-alist))))
- (define-key input-decode-map (concat escape-prefix escape-suffix)
- (read-kbd-macro (concat key-prefix key-suffix))))
- (setq suffix-alist (cdr suffix-alist))))
- (setq nav-key-pair-alist
- '(("A" . "<up>") ("B" . "<down>") ("C" . "<right>") ("D" . "<left>")
- ("H" . "<home>") ("F" . "<end>") ("I" . "<tab>") ("s" . "\"")
- ("l" . ",") ("n" . ";") ("^" . "<return>")))
- (add-escape-key-mapping-alist "\e[1;2" "S-" nav-key-pair-alist)
- (add-escape-key-mapping-alist "\e[1;3" "M-" nav-key-pair-alist)
- (add-escape-key-mapping-alist "\e[1;4" "M-S-" nav-key-pair-alist)
- (add-escape-key-mapping-alist "\e[1;5" "C-" nav-key-pair-alist)
- (add-escape-key-mapping-alist "\e[1;6" "C-S-" nav-key-pair-alist)
- (add-escape-key-mapping-alist "\e[1;7" "M-C-" nav-key-pair-alist)
- (add-escape-key-mapping-alist "\e[1;8" "M-C-S-" nav-key-pair-alist)
Add Comment
Please, Sign In to add comment