Emacs: Basic Key Shortcuts

By Xah Lee. Date: . Last updated: .

Open, Save, Close, File

keycommand namedescription
Ctrl+x Ctrl+ffind-fileOpen
Ctrl+x Ctrl+ssave-bufferSave
Ctrl+x kkill-bufferClose

Select Text

keycommand namedescription
Ctrl+Spaceset-mark-commandMark the starting point for copy/cut a text. (then move cursor to extend selection.)
Ctrl+x hmark-whole-bufferSelect All

Copy Paste Undo

keycommand namedescription
Ctrl+/undoUndo. (To redo, type Ctrl+g then undo. (all subsequent undo is redo, until you type something else.))

Move Cursor

Use the arrow keys , and Home, End, PageUp, PageDown keys.

Also availble are the following more complex keys.

keycommand namedescription
Ctrl+ or Alt+bbackward-wordMove cursor left by word.
Ctrl+ or Alt+fforward-wordMove cursor right by word.
Ctrl+Home or Alt+<beginning-of-bufferBeginning of file.
Ctrl+End or Alt+>end-of-bufferEnd of document.
keycommand namedescription
Ctrl+fforward-charMove cursor right 1 char.
Ctrl+bbackward-charMove cursor left 1 char.
keycommand namedescription
Ctrl+vscroll-up-commandpage down
Alt+vscroll-down-commandpage up

Delete Text

keycommand namedescription
Alt+dkill-wordDelete the word to the right.
Alt+Backspace ⌫backward-kill-wordDelete the previous word
Ctrl+kkill-lineDelete all characters from cursor to end of line

Split Window

keycommand namedescription
Ctrl+x 2split-window-belowSplit window top/bottom
Ctrl+x 3split-window-rightSplit window side by side
Ctrl+x 1delete-other-windowsRemove all split panes
Ctrl+x oother-windowMove 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]

Find Replace Text

Emacs Keybinding