Emacs: Basic Key Shortcuts
Open, Save, Close, File
key | command name | description |
---|---|---|
Ctrl+x Ctrl+f | find-file | Open |
Ctrl+x Ctrl+s | save-buffer | Save |
Ctrl+x k | kill-buffer | Close |
Select Text
key | command name | description |
---|---|---|
Ctrl+Space | set-mark-command | Mark the starting point for copy/cut a text. (then move cursor to extend selection.) |
Ctrl+x h | mark-whole-buffer | Select All |
Copy Paste Undo
key | command name | description |
---|---|---|
Ctrl+/ | undo | Undo. (To redo, type Ctrl+g then undo. (all subsequent undo is redo, until you type something else.)) |
Alt+w | kill-ring-save | Copy |
Ctrl+w | kill-region | Cut |
Ctrl+y | yank | Paste |
Move Cursor
Use the arrow keys ↑ ↓ ← →, and Home, End, PageUp, PageDown keys.
Also availble are the following more complex keys.
key | command name | description |
---|---|---|
Ctrl+← or Alt+b | backward-word | Move cursor left by word. |
Ctrl+→ or Alt+f | forward-word | Move cursor right by word. |
Ctrl+Home or Alt+< | beginning-of-buffer | Beginning of file. |
Ctrl+End or Alt+> | end-of-buffer | End of document. |
key | command name | description |
---|---|---|
Ctrl+f | forward-char | Move cursor right 1 char. |
Ctrl+b | backward-char | Move cursor left 1 char. |
key | command name | description |
---|---|---|
Ctrl+v | scroll-up-command | page down |
Alt+v | scroll-down-command | page up |
Delete Text
key | command name | description |
---|---|---|
Alt+d | kill-word | Delete the word to the right. |
Alt+Backspace ⌫ | backward-kill-word | Delete the previous word |
Ctrl+k | kill-line | Delete all characters from cursor to end of line |
Split Window
key | command name | description |
---|---|---|
Ctrl+x 2 | split-window-below | Split window top/bottom |
Ctrl+x 3 | split-window-right | Split window side by side |
Ctrl+x 1 | delete-other-windows | Remove all split panes |
Ctrl+x o | other-window | Move cursor to the other pane |
Search Text
To search a word, press Ctrl+s, then type your search text. Press Ctrl+s to find next occurrence. Press Enter to exit. 〔see Emacs: Search Text in Current File〕