GNU Emacs keyboard shortcuts

GNU Emacs

Zeynel Abidin Öztürk -
15 months ago
- Shortcuts
Ctrl + X then Ctrl + F

Read a file into Emacs

Ctrl + X then Ctrl + S

Save a file back to disk

Ctrl + X then S

Save all files

Ctrl + X then I

Insert contents of another file into this buffer

Ctrl + X then Ctrl + V

Replace this file with another file

Ctrl + X then Ctrl + W

Write buffer to specified file

Ctrl + X then Ctrl + Q

Toggle read only status of buffer

Ctrl + Z

Suspend or iconify Emacs

Ctrl + X then Ctrl + C

Exit Emacs completely

The help system is simple. Type Ctrl + H or F1 and follow the directions. If you are a first time user, type Ctrl + H for a tutorial.
Ctrl + X then 1

Remove help window

Ctrl + Meta + V

Scroll help window

Ctrl + H then A

Show commands matching a string

Ctrl + H then K

Describe the function a key runs

Ctrl + H then F

Describe a function

Ctrl + H then M

Get mode specific information

Ctrl + G

Abort partially typed or executing command

Meta + X

then type recover-session to recover files lost by a system crash

Ctrl + X then U

Undo an unwanted change

or Ctrl + _
or Ctrl + /
Meta + X

then type revert-buffer to restore a buffer to its original contents

Ctrl + L

Redraw garbaged screen

Ctrl + S

Search forward

Ctrl + R

Search backward

Ctrl + Meta + S

Regular expression search

Ctrl + Meta + R

Reverse regular expression search

Meta + P

Select previous search string

Meta + N

Select next later search string

⤶ Enter

Exit incremental search

Del

Undo effect of last character

Ctrl + G

Abort current search

Use Ctrl + S or Ctrl + R again to repeat the search in either direction. If Emacs is still searching, Ctrl + G cancels only the part not matched.
Ctrl + B

Character - backward

Ctrl + F

Character - forward

Meta + B

Word - backward

Meta + F

Word - forward

Ctrl + P

Line - backward

Ctrl + N

Line - forward

Ctrl + A

Go to line beginning

Ctrl + E

Go to line ending

Meta + A

Sentence - backward

Meta + E

Sentence - forward

Meta + {

Paragraph - backward

Meta + }

Paragraph - forward

Ctrl + X then [

Page - backward

Ctrl + X then ]

Page - forward

Ctrl + Meta + B

sexp - backward

Ctrl + Meta + F

sexp - forward

Ctrl + Meta + A

function - backward

Ctrl + Meta + E

function - forward

Meta + <

Go to beginning of buffer

Meta + >

Go to end of buffer

Ctrl + V

Scroll to next screen

Meta + V

Scroll to previous screen

Ctrl + X then <

Scroll left

Ctrl + X then >

Scroll right

Ctrl + L

Scroll current line to center, top, bottom

Meta + G then G

Go to line

Meta + G then C

Go to character

Meta + M

Back to indentation

Del

Character (delete, not kill) - backward

Ctrl + D

Character (delete, not kill) - forward

Meta + Del

Word - backward

Meta + D

Word - forward

Meta + 0 then Ctrl + K

Line (to end of) - backward

Ctrl + K

Line (to end of) - forward

Ctrl + X then Del

Sentence - backward

Meta + K

Sentence - forward

Meta + - then Ctrl + Meta + K

sexp - backward

Ctrl + Meta + K

sexp - forward

Ctrl + W

Kill region

Meta + W

Copy region to kill ring

Meta + Z

then press char to kill through next occurence of char

Ctrl + Y

Yank back last thing killed

Meta + Y

Replace last yank with previous kill

Ctrl + @

Set mark here

or Ctrl + Space
Ctrl + X then Ctrl + X

Exchange point and mark

Meta + @

Set mark arg words away

Meta + H

Mark paragraph

Ctrl + X then Ctrl + P

Mark page

Ctrl + Meta + @

Mark sexp

Ctrl + Meta + H

Mark function

Ctrl + X then H

Mark entire buffer

Meta + % then Meta + X

(then query-replace-regexp) Interactively replace a text string using regular expressions

Valid responses in query-replace mode are replace, skip, back up and exit.
Space

Replace this one, go to next

or Y
Del

Skip to next without replacing

or N
!

Replace all remaining matches

^

Back up to the previous match

⤶ Enter

Exit query-replace

Ctrl + R

Enter recursive edit

Ctrl + Meta + C

Exit recursive edit

Ctrl + X then 1

Delete all other windows

Ctrl + X then 5 then 1

Delete all other windows (for frame)

Ctrl + X then 2

Split window, above and below

Ctrl + + X then 5 then 2

Split window, above and below (for frame)

Ctrl + X then 0

Delete this window

Ctrl + X then 5 then 0

Delete this window (for frame)

Ctrl + X then 3

Split window, side by side

Ctrl + Meta + V

Scroll other window

Ctrl + X then O

Switch cursor to another window

Ctrl + X then 5 then O

Switch cursor to another window (for frame)

Ctrl + X then 4 then B

Select buffer in other window

Ctrl + X then 5 then B

Select buffer in other window (for frame)

Ctrl + X then 4 then Ctrl + O

Display buffer in other window

Ctrl + X then 5 then Ctrl + O

Display buffer in other window (for frame)

Ctrl + X then 4 then F

Find file in other window

Ctrl + X then 5 then F

Find file in other window (for frame)

Ctrl + X then 4 then R

Find file read-only in other window

Ctrl + X then 5 then R

Find file read-only in other window (for frame)

Ctrl + X then 4 then D

Run Dired in other window

Ctrl + X then 5 then D

Run Dired in other window (for frame)

Ctrl + X then 4 then .

Find tag in other window

Ctrl + X then 5 then .

Find tag in other window (for frame)

Ctrl + X then ^

Grow window taller

Ctrl + X then {

Shrink window smaller

Ctrl + X then }

Grow window wider

⭾ Tab

Indent current line (mode-dependent)

Ctrl + Meta + \

Indent region (mode-dependent)

Ctrl + Meta + Q

Indent sexp (mode-dependent)

Ctrl + X then ⭾ Tab

Indent region rigidly arg columns

Meta + ;

Indent for comment

Ctrl + O

Insert newline after point

Ctrl + Meta + O

Move rest of line vertically down

Ctrl + X then Ctrl + O

Delete blank lines around point

Meta + ^

Join line with previous (with arg, next)

Meta + \

Delete all white space around point

Meta + Space

Put exactly one space at point

Meta + Q

Fill paragraph

Ctrl + X then F

Set fill column to arg

Ctrl + X then .

Prefix each line starts with

Meta + O

Set face

Meta + U

Uppercase word

Meta + L

Lowercase word

Meta + C

Capitalize word

Ctrl + X then Ctrl + U

Uppercase region

Ctrl + X then Ctrl + L

Lowercase region

The following keys are defined in the minibuffer.
⭾ Tab

Complete as much as possible

Space

Complete up to one word

⤶ Enter

Complete and execute

?

Show possible completions

Meta + P

Fetch previous minibuffer input

Meta + N

Fetch later minibuffer input or default

Meta + R

Regexp search backward through history

Meta + S

Regexp search forward through history

Ctrl + G

Abort command

Ctrl + X then Esc then Esc

Edit and repeat the last command that used the minibuffer

F10

Activate menu bar items in text terminals

Ctrl + X then B

Select another buffer

Ctrl + X then Ctrl + B

List all buffers

Ctrl + X then K

Kill a buffer

Ctrl + T

Transpose characters

Meta + T

Transpose words

Ctrl + X then Ctrl + T

Transpose lines

Ctrl + Meta + T

Transpose sexps

Meta + $

Check spelling of current word

Meta + X

(then ispell-region) Check spelling of all words in region

Meta + X

(then ispell-buffer) Check spelling of entire buffer

Meta + X

(then flyspell-mode) Toggle on-the-fly spell checking

Meta + .

Find a tag (a definition)

Ctrl + U then Meta + .

Find next occurence of a tag

Meta + X

(then visit-tags-table) Specify new tags file

Meta + X

(then tags-search) Regexp search on all files in tags table

Meta + X

(then tags-query-replace) Run query-replace on all the files

Meta + ,

Continue last tags search on query-replace

Meta + !

Execute a shell command

Meta + &

Execute a shell command asynchronously

Meta + |

Run a shell command on the region

Meta + X

(then type shell) Start a shell window *shell*

Ctrl + X then R then R

Copy rectangle to register

Ctrl + X then R then K

Kill rectangle

Ctrl + X then R then Y

Yank rectangle

Ctrl + X then R then O

Open rectangle, shifting text right

Ctrl + X then R then C

Black out rectangle

Ctrl + X then R then T

Prefix each line with string

Ctrl + X then A then G

Add global abbrev

Ctrl + X then A then L

Add mode-local abbrev

Ctrl + X then A then I then G

Add global expansion for this abbrev

Ctrl + X then A then I then L

Add mode-local expansion for this abbrev

Ctrl + X then A then E

Explicitly expand abbrev

Meta + /

Expand previous word dynamically

Ctrl + U then Num 0 - Num 9

Numeric argument

Meta + -

Negative argument

Ctrl + Q

then char: Quoted insert

Ctrl + \

Enable or disable input method

Ctrl + H then I

Enter the Info documentation reader

Ctrl + H then S

Find specified function or variable in Info

Space

Scroll forward

Del

Scroll reverse

B

Beginning of node

N

Go to next node

P

Go to previous node

U

Move up

M

Select menu item by name

Num 1 - Num 9

Select menu item by number

F

Follow cross reference (return with 1)

L

Return to last node you saw

D

Return to directory node

T

Go to top node of Info file

G

Go to any node by name

H

Run info tutorial

I

Look up a subject in the indices

S

Search nodes for regexp

Q

Quit Info

Ctrl + X then R then S

Save region in register

Ctrl + X then R then I

Insert register contents into buffer

Ctrl + X then R then Space

Save value of point in register

Ctrl + X then R then J

Jump to point saved in register

Ctrl + X then (

Start defining a keyboard macro

Ctrl + X then )

End keyboard macro definition

Ctrl + X then E

Eappend to last keyboard macro

Meta + X

(then name-last-kbd-macro) name last keyboard macro

Meta + X

(then insert-kbd-macro) Instert Lisp definition in buffer

Ctrl + X then Ctrl + E

Eval sexp before point

Ctrl + Meta + X

Eval current defun

Meta + X

(then eval-region) Eval region

Meta + :

Read and eval minibuffer

Meta + X

(then load-library) load a Lisp library from load-path

Meta + X

(then customize) Customize variables and faces


Share this page on:

Program information

Program name: GNU Emacs (Text editing)

GNU Emacs is the most popular port of the Emacs text editor. It's developed by GNU Project's founder Richard Stallman and dubbed "most powerful text editor of today". GNU Emacs can open text files in multiple character sets and its functionality can be enhanced with Emacs Lisp programs.

Web page: https://www.gnu.org/s/emacs

Shortcut count: 220

Similar programs


  1. Keyboard symbolsKeyboard symbols
    38724    1
  2. Grand Theft Auto VGrand Theft Auto V
    33131   
  3. Apex Legends (PC)Apex Legends (PC)
    31999   
  4. Fortnite (PC)Fortnite (PC)
    29740    2
  5. PlayerUnknown's BattlegPlayerUnknown's Battleg
    29369    2
  6. The Sims 4The Sims 4
    27417    3
More keyboard shortcuts...

Latest articles

Advertisement

  Subscribe to our mailing list!

Useful technology tips and keyboard shortcuts will appear in your inbox.

Your email is kept private and we don't spam.

What is your favorite GNU Emacs hotkey? Do you have any useful tips for program? Let other users know below.