Emacs Quick Reference
From SquadLimberWiki
Contents |
[edit]
Help
Most emacs commands, e.g. C-s, are just shortcuts for macros. Macros/commands can be run by typing:
M-x command-name
You can press TAB to see possible completions of a command. Try it:
M-x search<TAB>
Press C-g to abort running a command and close the possible completions window.
The best way to find out a way of doing something in emacs is to use M-x or C-h a.
[edit]
Help Commands
| C-h | Help |
| C-h a | Apropos |
[edit]
Text Editing
| C-_ | Undo |
| C-SPC followed by M-w | Copy the text between where C-SPC and M-w were pressed |
| C-SPC followed by C-w | Cut the text between where C-SPC and C-w were pressed |
| C-k | Kill the text to the end of line |
| C-y | Yank (Paste) |
| M-y | Yank from history (Cycle through clipboard history) |
[edit]
Navigation
| C-v / M-v | Page down / up |
| M-< / M-> | Start / End of file |
| C-a / C-e | Start / End of line |
[edit]
Oops I typed some command I didn't mean to
| C-g | Cancel |
[edit]
Searching and Replacing
| C-s | Search forward |
| C-r | Reverse search |
| C-M-s | Regex search |
| M-% | Search & Replace - Type y/n to replace each occurence in turn or '!' to replace all |
| M-x goto-line | Go to line. duh. |
[edit]
Saving and Exiting
| C-x C-s | Save |
| C-x C-c | Exit |
| M-x kill-emacs | Exit instantly without asking to save |
[edit]
Do Something N times
| C-u N <command> | Does the next command N times e.g. C-u 5 C-k kills the next 5 lines. |
[edit]
Code & Text Completion
| M-/ | Code/Text completion - depends on what mode you are in |
[edit]
Syntax Highlighting
| M-x global-font-lock-mode | Toggles syntax highlighting - depends on what mode you are in |
[edit]
Windows
| C-x 1 | Close all windows but this one |
| C-x o | Other window - switch to another window |
[edit]
Example Macro For Emacs (Lisp)
See [1]
[edit]
General Emacs Programming
See [2]

