next up previous contents
Next: Fonts and Colors Up: Customizing your Environment Previous: Macros   Contents


Keyboard Shortcuts

Emacsen are most frequently derided for difficult key combinations using one or more of shift/alt/control etc. You can create easier keystroke combinations to suit your needs by editing the .emacs file in your home directory. Add lines like the following:

 
(global-set-key [f1] 'goto-line) 
(global-set-key[?\M-\l] 'next-line) 
(global-set-key [?\C-x ?\w] 'beginning-of-buffer)
(add-hook 'text-mode-hook 'longlines-mode)
(global-unset-key (kbd "M-j")  )
(global-set-key  (kbd "M-j")  'join-line) 
(global-set-key (kbd "M-*") "dookie")

The first three lines above set the F1 key to the command ``goto-line,'' Alt-l to ``next line'' and C-x w to ``beginning of buffer.'' Type C-h b to get a listing of all current key bindings. The fourth line instructs emacs to load the longlines.el package whenever it edits in text mode. The fifth and sixth lines remove the previous keybinding for Alt-J and reassign it to the command join-line. The seventh is an example of how you can bind a key stroke to a character you wouldn't normally find on your keyboard or a whole word you don't want to have to retype each time.

Note the many different styles for representing keystrokes. I find that in earlier versions of emacs the ?\M notation was necessary, while in versions 22 and up the (kbd) notation works better.


next up previous contents
Next: Fonts and Colors Up: Customizing your Environment Previous: Macros   Contents
Randall Wood 2011-03-31