Emacs Commands
The newly learned ones:
C-x i
: insert fileC-x C-v
: Find alternative fileC-x C-w
: Save as copyC-h
: Enter helpC-h k
: Help about keystrokeC-h f
: Help about function
Use goto-line
command to go to a specific line.
C-_
: Undo (same asC-x u
)M-d
: Delete a word on the cursor (handy!)
Everything you delete with C-k
, C-w
and copy with M-w
will go into the kind ring. C-u
with Del
or C-d
will go into the kill ring as well. But the sole single chatacter deletion will not go into the kill ring.
C-space
: activate the mark regionC-x C-x
: Verify the selected regionC-w
: Delete the currently marked region;M-h
: Mark a paragraphC-x h
: Mark the entire bufferM-w
: kill-ring-save, which could be used in copying text.M-y
: delete the most recent text in kill ring and get the next ones
M-c
: Capitalize the first characterM-l
: Put a word in lowercaseM-u
: Put a word in uppercaseM-x ov
: Toggle overwrite modeM-x revert-buffer
: Undo all changes made since last savingC-r
: Backward searchingC-s C-w
: Search the wordC-s C-y
: Search the text till the end of lineC-s Enter
: Non-incremental searchM-%
: Query replace
- The variable
case-fold-search
determines whether searches are case-sensitive. - The variable
case-replace
determines whether to replace according to the old capitalization pattern.
C-M-s
: Regex Incremental searchC-M-%
: Regex query replace
NOTE: Spell checking a text needs installation of ispell
or flyspell
, so the related chapters in Learning GNU Emacs are ignored here
M-/
: Complete the word with nearest word with that as prefix (Can search cyclically when used repeatly)
- Command
abbrev-mode
: abbreviation modeC-x a i g
: foradd-inverse-global
C-x a i l
: foradd-inverse-local
edit-abbrevs
list-abbrevs
kill-all-abbrevs
: Stop use of all abbreviations
C-x b
: switching between buffersC-x C-b
: show buffer listC-x ->
: Cycle through the buffersC-x k
: Delete a bufferkill-some-buffers
can do the above in a batch way
C-x 4 f
: to open a file in a new windowC-x 4 b
: to open a buffr in a new windowC-M-v
: to scroll the other windowC-x o
: move from one window to anotherC-x 0
: delete the window you are in
C-x s
: Save all buffersC-x C-q
: Make any buffer read-only
C-x ^
: Make the current window tallerC-x }
: Make the current window widerC-x {
: Make the current window narrower
C-x r m
: Place a bookmark at the cursor positionC-x r b
: Jump to a bookmarkC-x r l
: List all bookmarks
Under dired
:
n
,p
etc.: move between linesv
: preview fileC-x d
: Start DiredA
: Do a regular search on marked files,M-
to find next matchB
: Byte-compile fileC
: Copy filed
: flag for deletionD
: Delete instantlye
: Edit filef
: Findg
: Refreshi
: Insert a listing of subdirectory to the current dired bufferL
: Load filem
: MarkM
: chmodo
: Find file in another window and move thereC-o
: Find file but don't moveQ
: Query replace string in marked filesR
: rename files
: Sort the display by date or by filenamev
: View file in read-only modew
: copy the filename into kill ringZ
: compress.
: Flag numbered backups for deletion!
: Do shell commmand on current or marked files+
: create a directory^
: move up to parent directory
compile
goes to compilation mode
- C-x `: move to next error and its position
M-n
: Move to next error messageM-p
: Move to next previous messageC-c C-c
: Visit source for current error message
M-;
: Indent for commentC-M-\
: Indent each line in the regionM-m
: Back to the first non-blank character on the line
visit-tags-table
: Connect theTAGS
file generated byetags
to EmacsM-
: find tag
list-faces-display
: List all code font
C, C++ support
M-a
: move to the beginning of current statementC-M-a
: Moveto the beginning of surrouding functionC-M-h
: Mark the entire functionC-c C-u
: Move to the beginning of current preprocessor conditionalc-set-style
: Set C language style ˘