Emacs Keys Basics

By Xah Lee. Date: . Last updated: .

Open, Save, Close, File

Copy Paste Undo

Moving Cursor

Use the arrow keys    , and Home, End, Page Up, Page Down keys.

Deleting Text

Select Text

Split Window

Searching Text

To search a word, press 【Ctrl+s】, then type your search text, emacs will move the cursor to the location of the matched text as you type. Press 【Ctrl+s】 again to jump to the next occurrence, press 【Ctrl+r】 to jump to the previous occurrence.

Once you found what you are looking for, press Enter to exit.

To exit search and leave the cursor at the place before search started, press 【Ctrl+g】.

For detail, see: Emacs: Search Text in Buffer.

Find Replace Text

See: Emacs: Find and Replace Commands.

Standard Copy Paste Keys

emacs cua mode menu
emacs cua mode menu

To have standard keys for copy cut paste , turn on CUA mode,

Alt+x cua-mode

cua-mode activates the following keyboard shortcuts:

To have cua-mode always on, put the following in your emacs init.

;; use C-x for cut
;; C-c for copy
;; C-v for paste
(cua-mode 1)

Everything is a Command

In emacs, every keystroke executes a command. For example, when you type a key e, emacs actually runs the command self-insert-command.

Any key or key combination sequence you press ultimately calls a command.

There are over 3 thousand commands in emacs by default.

Most commonly used commands have a keyboard shortcut, such as moving the cursor, opening file, copy paste, close a file, search text.

To run a command by name, type 【Alt+x】 followed by the command name.

Finding a Command's Name or Keyboard Shortcut

If you know a command's name, you can find out its keyboard shortcut (if there is one) by Alt+x describe-function

If you know a keyboard shortcut, you can find out what command it is bind to, by Alt+x describe-key

How to Define Keys

You can define your own keys for any command.

Emacs: How to Define Keys

Emacs Quick Start

  1. Where to Download?
  2. Fun with Emacs
  3. Emacs First Day
  4. Basic Emacs Keys
  5. Basic Tips
  6. Less-known Tips
  7. Emacs on Windows

Emacs Keys for Beginner

  1. Emacs Keys Basics
  2. Emacs Keys Overview
  3. Key Layout Diagram
  4. How to Define Keys

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs


Emacs Lisp