Emacs Quick Reference

From SquadLimberWiki

Jump to: navigation, search

Contents

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.

Help Commands

C-hHelp
C-h aApropos


Text Editing

C-_Undo
C-SPC followed by M-wCopy the text between where C-SPC and M-w were pressed
C-SPC followed by C-wCut the text between where C-SPC and C-w were pressed
C-kKill the text to the end of line
C-yYank (Paste)
M-yYank from history (Cycle through clipboard history)


Navigation

C-v / M-vPage down / up
M-< / M->Start / End of file
C-a / C-eStart / End of line


Oops I typed some command I didn't mean to

C-gCancel


Searching and Replacing

C-sSearch forward
C-rReverse search
C-M-sRegex search
M-%Search & Replace - Type y/n to replace each occurence in turn or '!' to replace all
M-x goto-lineGo to line. duh.


Saving and Exiting

C-x C-sSave
C-x C-cExit
M-x kill-emacsExit instantly without asking to save


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.


Code & Text Completion

M-/Code/Text completion - depends on what mode you are in


Syntax Highlighting

M-x global-font-lock-modeToggles syntax highlighting - depends on what mode you are in


Windows

C-x 1Close all windows but this one
C-x oOther window - switch to another window


Example Macro For Emacs (Lisp)

See [1]


General Emacs Programming

See [2]

Personal tools