256
Logo

Basic Emacs Commands

This file documents a very small subset of the commands for emacs. Most of the directions also apply to jove which is an emacs emulator.

The editor is most always in insert mode. In other words, you are always inserting characters into the file you are editing. Below you will see a list of key combinations on the left hand side and a description for what it does on the right.

To press shift, control, or meta characters, press and hold one of these keys and then press (but don't hold) the key you want to shift, control, or meta.

NOTE: Be careful about pressing and holding a key (whether it be c or control-c) because most keyboards will repeat the character which is not necessarily what you want to do.

Definitions

shift
key often labeled Shift that has special meaning. It is the key that capitalizes the character you are typing or gives you access to the characters at the top of the keys. To make an uppercase t you press 'shift-t' that is you press and hold the shift key and then press and release t.
control
key often labeled Ctrl that has special meaning. It is used like the shift key. To get a 'control-x' you press and hold the control key and then press and release x.
meta

key often labeled Meta, Alt, Compose, <>, etc. that also has special meaning. Meta characters are used as "extended commands". For example 'Meta-k' (which means press and hold the meta key and then press k) kills a sentence.

If your keyboard doesn't have meta functionality then you can use the Escape key to simulate meta. 'Meta-k' can be executed by doing an 'Escape k' (press the escape key but release, don't hold it, and then press k).

backspace
Often labeled 'Delete' or '<-', this is designed to remove the key to the left of the cursor or the last key you pressed. Some terminals define backspace to send 'control-h'. The editor does not take kindly to this and thinks you want to get help. Your backspace key should send delete -- if it doesn't then see your documentation on how to change it to do so.
key-stroke
a single character: 'a', 'f', 'control-t', 'escape', 'z', 'meta-v' etc.
key-sequence
one or more key-strokes that makes up a command: 'escape z', 'control-x control-s'

Special Keys

control-g
cancels commands and most everything else
meta-x
starts extended commands (or 'Escape x')

Normal Control Sequences

control-a
go to start of line
control-b
backwards character (left arrow may also work)
control-d
deletes the character the cursor is on
control-e
go to end of line
control-f
forward character (right arrow may also work)
control-h
extensive online help facilities. 'control-h t' gets you to the online tutorial.
control-k
kills the text from the cursor to the end of the line and puts it in the kill buffer (see control-y, yank). If the line is empty it removes it. control-k control-k removes a line.
control-l
redraws the screen
control-n
go down to the next-line (down arrow may also work)
control-o
open a line at the cursor (insert a return)
control-p
go up to the previous-line (up arrow may also work)
control-r
reverse search (search back through the file)
control-s
forward search (search forward through the file)
control-v
move down a page (the PageDown key may also work)
control-y
yanks the kill buffer. whenever you control-k (kill) something, it gets put into a "kill-buffer". Multiple kills append to the kill buffer. yank inserts the kill buffer at the cursor. To move a section from one spot in the file to another, first kill it with control-k's, then move to where you want it put and press control-y.
control-/
Undo the last action. control-/ may not work on some keyboards. 'control-x control-u' or 'control-_' may work instead.
meta-v
move up a page (the PageUp key may also work)
meta-a
backwards sentence (move to start of sentence)
meta-e
forward sentence (move to end of sentence)
meta-f
forward word (move to next word)
meta-b
backwards word (move to last word)

Extended Control Sequences

control-x control-c
quit editor (it will stop you if you have not saved your file)
control-x control-f
find-file or edit another file. it will ask you for the file name.
control-x control-s
save the file

For More Info

Emacs has a very nice built help system including a build int tutorial. To get to the help system you start by pressing 'control-h' (press and release control-h). From there, to get to the tutorial you press a 't' (press and release t).

Free Spam Protection   Android ORM   Simple Java Magic   JMX using HTTP   Great Eggnog Recipe   Massachusetts Covid Vaccine Sites