Emacs: Basic Key Shortcuts

By Xah Lee. Date: . Last updated: .

Open, Save, Close, File

Ctrl+x Ctrl+f (find-file)
Open
Ctrl+x Ctrl+s (save-buffer)
Save
Ctrl+x k (kill-buffer)
Close

Move Cursor

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

Ctrl+ and Ctrl+ to move by word.

Ctrl+ and Ctrl+ to move by paragraph.

Also availble are the following more complex keys.

Ctrl+Home or Alt+< (beginning-of-buffer)
Beginning of file.
Ctrl+End or Alt+> (end-of-buffer)
End of document.

Select Text

you can hold shift key, and move cursor.

or

Ctrl+Space (set-mark-command)
Mark the starting position for copy/cut a text. (then move cursor to extend selection.)
Ctrl+x h (mark-whole-buffer)
Select All

Copy Paste

Alt+w (kill-ring-save)
Copy
Ctrl+w (kill-region)
Cut
Ctrl+y (yank)
Paste

Undo Redo

Ctrl+/ (undo)
Undo.
Ctrl+? (undo-redo)
redo.

Page Up Down

Ctrl+v (scroll-up-command)
page down
Alt+v (scroll-down-command)
page up

Delete Text

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

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.

Find Replace Text

emacs basics

Emacs Keybinding