Skip to content

Latest commit

 

History

History
449 lines (325 loc) · 7.4 KB

emacs-cheat-sheet.adoc

File metadata and controls

449 lines (325 loc) · 7.4 KB

Emacs Cheat Sheet

Legend

Control key

Ctrl

Meta or Alt key on most keyboards

Meta

Super or the windows key on most keyboards

Super

Press two or more keys at the same time

key1+key2

Press one key then press the other key

key1 - key2

All keys are the default keys supplied by either Emacs or the package.

General Emacs web sites that come in handy.

EmacsWiki.org

The EmacsWiki is dedicated to documenting and discussing Emacs, XEmacs and EmacsLisp.

GNU Emacs

Official Emacs Website.

Leaving Emacs

Suspend Emacs (or iconify it under X)

Ctrl+z

Exit Emacs permanently

Ctrl+x Ctrl+c

Files

Read a file into Emacs

Ctrl+x - Ctrl+f

Save a file

Ctrl+x - Ctrl+s

Save all Files

Ctrl+x - s

Insert contents of another file into this buffer

Ctrl+x - i

replace this file with the file you really want

Ctrl+x - Ctrl+v

write buffer to specified file

Ctrl+x - Ctrl+w

toggle read-only status of buffer

Ctrl+x - Ctrl+q

Movement keys

Item to move over Backward Forward

character

Ctrl+b

Ctrl+f

word

Meta+b

Meta+f

line

Ctrl+p

Ctrl+n

go to line beginning or end

Ctrl+a

Ctrl+e

sentence

Meta+a

Meta+e

paragraph

Meta+{

Meta+}

page

Ctrl+x - [

Ctrl+x - ]

sexp

Ctrl+Meta+b

Ctrl+Meta+f

function

Ctrl+Meta+a

Ctrl+Meta+e

go to buffer beginning or end

Meta+<

Meta+>

Scroll to next screen

Ctrl+v

scroll to previous screen

Meta+v

scroll left

Ctrl+x - <

scroll right

Ctrl+x - >

scroll current line to center, top, bottom

Ctrl+l

goto line

Meta+g + g

goto char

Meta+g + c

Back to indentation

Meta+m

Getting Help

Scroll help window

Ctrl+Meta+v

apropos: show commands matching a string

Ctrl+h - a

describe key or the function that the key runs.

Ctrl+h - k

describe a function

Ctrl+h - f

get mode-specific information

Ctrl+h - m

List all key binding

Ctrl+h + b

List prefix bindings. Press the prefix first

Ctrl+h or F1

List value of a variable and its description

Ctrl+h + v

Error Recovery

Abort partially typed or executing command

Ctrl+g

Undo an unwanted change

Ctrl+x - u, Ctrl+_ or Ctrl-/

restore a buffer to its original contents

Meta+x - ‘revert-buffer’

redraw garbage screen

Ctrl+1

Killing and Deleting

Item to kill backward forward

Character Delete, not kill

DEL

Ctrl-d or Backspace

word

Meta+DEL

Meta+d or Meta+Backspace

line to end of

Meta+0 - Ctrl+k

Ctrl-k

sentence

Ctrl-x - DEL

Meta-k

sexp

Meta+- - Ctrl+Meta+k

Ctrl+Meta+k

Kill region

Ctrl+w

copy region to kill ring

Meta+w

Kill through next occurrence of char

Meta+z - ‘char’

Yank back last thing killed

Ctrl+y

Replace last yank with previous kill

Meta+y

Marking

set mark here

Ctrl+@ or Ctrl+Space

exchange point and mark

Ctrl+x - Ctrl+x

set mark arg words away

Meta-@

mark paragraph

Meta+h

mark page

Ctrl+x - Ctrl+p

mark sexp

Ctrl+Meta+@

mark function

Ctrl+Meta+h

mark entire buffer

Ctrl+x - h

Buffers

Select another buffer

Ctrl+x - b

list all buffers

Ctrl+x - Ctrl+b

kill a buffer

Ctrl+x - k

Multiple Windows

Delete all other windows

Ctrl+x - 1

Split window, above and below

Ctrl+x - 2

Delete this window

Ctrl+x - 0

Split window, side by side

Ctrl+x - 3

Scroll other window

Ctrl+Meta+v

Switch cursor to another window

Ctrl+x - o

Search forward

Ctrl+s

search backward

Ctrl+r

regular expression search

Ctrl+Meta+s

reverse regular expression search

Ctrl+Meta+r

select previous search string

Meta+p

select next later search string

Meta+n

exit incremental search

Enter

Undo effect of last character

Delete

abort current search

Ctrl+g

Use Ctrl+s or Ctrl+r to repeat the search in either direction.

In the Minibuffer

Complete as much as possible

TAB

Complete up to one word

Space

Complete and execute

Enter

Show possible completions

?

Fetch previous minibuffer input

Meta+p

Fetch later minibuffer input or default

Meta+n

Regexp search backward through history

Meta+r

Regexp search forward through history

Meta+s

Edit and repeat the last command that used the minibuffer

Ctrl+x - Escape - Escape

Activate menu bar items on text terminals

F10

Dired Mode

Enter Dired Mode

Ctrl+x-d(dired) or kbd[Ctrl+x] - Ctrl+f(find file)

Mark files for deletion

d

Remove the deletion flag

u

Execute the deletion

x

Flag all auto-save files (files whose names start and end with ‘#’) for deletion.

#

Flag all backup files (files whose names end with ‘~’) for deletion.

~

Visit(open) the file described on the current line.

f or Ret or e

Like f, but uses another window to display the file’s buffer. The Dired buffer remains visible in the first window. This is like using Ctrl+x 4 Ctrl+f to visit the file.

o

Visit the file described on the current line, and display the buffer in another window, but do not select that window.

Ctrl+o

View the file described on the current line, with View mode. View mode provides convenient commands to navigate the buffer but forbids changing it.

v

Visit the parent directory of the current directory. This is equivalent to moving to the line for .. and typing f there.

^

Dired Marks

Instead of flagging a file with ‘D’, you can mark the file with some other character (usually ‘’). Most Dired commands to operate on files use the files marked with ‘’. The only command that operates on flagged files is x, which deletes them.

Mark the current file with ‘*’(dired-mark). If the region is active, mark all files in the region instead; otherwise, if a numeric argument n is supplied, mark the next n files instead, starting with the current file(if n is negative, mark the previous -n files).

m or * m

Mark all executable files with ‘*’(dired-mark-executables). With a numeric argument, unmark all those files.

* *