Links to check
Movement
| |
|
Forward
|
|
Backward
|
| Unit |
|
Key |
|
Function |
|
Key |
|
Function
|
| Character |
|
C-f |
|
Move one character forward |
|
C-b |
|
Move one character backward
|
| Word |
|
M-f |
|
Move one word forward |
|
M-b |
|
Move one word backward
|
| Line |
|
C-n |
|
Move to next line |
|
C-p |
|
Move to previous line
|
| Line |
|
C-e |
|
Move to end of line |
|
C-a |
|
Move to beginning of line
|
| Sentence |
|
M-e |
|
Move forward to end of sentence |
|
M-a |
|
Move back to beginning of sentence
|
| Document |
|
M-> |
|
Move to the end of the document |
|
M-< |
|
Move to the start of the document
|
Editing
| Key |
|
Function
|
| <DelBack> |
|
BackSpace - Delete character just before cursor
|
| C-d |
|
Delete next character after the cursor
|
| M-<DelBack> |
|
Kill word before cursor
|
| M-d |
|
Kill word after the cursor
|
| C-k |
|
Kill to end of line (not including the newline). When given a count parameter C-k will kill to end of line including the newline for each count.
|
| M-k |
|
Kill to end of sentence
|
| C-@ |
|
Set mark
|
| C-Spc |
|
Set mark
|
| C-w |
|
Kill from set mark to just before cursor position
|
| C-y |
|
Yank back killed text at current cursor position. M-y will then cycle through earlier killed texts.
|
File handling, buffers and exiting
| Key |
|
Function
|
| C-x C-f |
|
find (open or create) file (prompted for filename)
|
| C-x C-s |
|
save file
|
| C-x C-w |
|
save file as ...
|
| C-x s |
|
save all files
|
| C-x C-c |
|
save files, exit emacs
|
| C-x k |
|
kill current buffer
|
| C-x b |
|
move to or create another buffer (prompt for buffer name)
|
| C-x C-b |
|
show buffer list
|
| C-x i |
|
insert file at cursor position
|
Ctags in Emacs
Generate the TAGS file by running this script in your source directory:
#!/bin/bash
find /usr/include -name \*.h | xargs etags -a
find /usr/local/include -name \*.h | xargs etags -a
etags -a *.c *.cc *.scc *.cpp ../incl/*.h ../incl/tm3/*.h ../shared/*.h *.cinclude
The -a parameter appends to an existing TAGS file.
| Key |
|
Function
|
| M-. <Enter> |
Go to tag under the cursor
|
| M-. <tag> <Enter> |
Search for a specific tag
|
| C-u M-. |
Go to the next definition for the last tag found
|
| M-* |
Go back to where you invoked "M-."
|
Various
| Key |
|
Function
|
| C-u |
|
Repeat count for command. Alternate: Hold M while typing count. C-v and M-V scrolls by that many lines when given a repeat count
|
| C-g |
|
Abort command or repeat count
|
| C-x 1 |
|
Back to one window
|
| C-h k <key> |
|
Get help on key
|