Show Menu
Cheatography

Basic concepts and default key mappings as outlined in the user manual.

Changing modes

<ES­C>
Exit from other modes into NORMAL mode
i/I
Enter INSERT mode, cursor placed before the current charac­ter­/first character in line
a/A
Enter INSERT mode, cursor placed after the current charac­ter/the end of the line
o/O
Creates a new, empty line below/­above the cursor, and enter INSERT mode
v
Enter Visual mode, cursor movement selection
V
Enter Visual mode, line selection
<CTRL>-v
Enter Visual mode, block selection
:
Enter COMMAN­D-LINE mode

NORMAL mode

J
Join line at cursor with line below it
u
Undo last edit
U
Undoes all the changes made on the last line that was edited
p
Put
<CTRL>-r
Reverse the preceding command
ZZ
Writes the file and exits

Operators

y
Copy (Yank)
c
Change (deletes and enters INSERT mode)
d
Delete

Selection

w
Word
W
WORD
s
Sentence
p
Paragraph
[ or ]
[] block
( or ) or b
() block
< or >
<> block
{ or }
{} Block
These are preceded by either i (Inner) or a (as in A word), and the inner ones exclude space and delimiters from the selection

Motions

w/W
Start of the next word/WORD
b/B
Start of the previous word/WORD
e/E
End of the next word/WORD
ge/gE
End of the previous word/WORD
0 or <HOME>
Very first character of the line
^
First non-blank character of the line
$
End of a line (eol)
f/F{char}
Forwar­d/b­ack­wards to character {char}
t/T{char}
Like f/F but stops on character before (To)
%
Matching pair (for parent­hesis, square brackets and squiglies)

Cursor motions

h or <RIGHT>
Right
k or <UP>
Up
j or <DO­WN>
Down
l or <LE­FT>
Left
H
First line on screen (High)
M
Middle line on screen (Middle)
L
Last line on screen (Low)

Scrolling Motions

<CTRL>-u
Scroll half a page up
<CT­RL>-d
Scroll half a page down
<CT­RL>-y
Scroll up one line
<CT­RL>-e
Scroll down one line
<CT­RL>-b
Scroll up (Back) one screen minus 2 lines
<CT­RL>-f
Scroll down (Forward) one screen minus 2 lines
zt
Move cursor line to the top of screen
zz
Move cursor line to middle of screen
zb
Move cursor line to the bottom of screen

Windows

<CTRL>-w w
Jump between the windows
<CT­RL>-w t
Move to the TOP window
<CT­RL>-w b
Move to the BOTTOM window
<CT­RL>-w +
Increase the size of a window
<CT­RL>-w -
Decrease the size of a window
You can also use <CT­RL>-w followed by h, j, k and l to navigate opened windows, and H, J, K and L to move windows around.
 

Shortcuts

s
Change one character
x
Delete character under the cursor
X
Delete character left of the cursor
r
Waits for you to type a character, and will replace the character under the cursor with it
C
Change to the end of line
D
Delete to the end of line
yy
Copy a whole line
cc or S
Change a whole line
dd
Deletes a whole line
.
Repeats the last change (except undo)

VISUAL BLOCK mode

o
Change cursor to the other end of the selection
O
Change corner in block selection
I{string}<Esc>
Inserts the text {string} in each line, to the left of the block
A{string}<Esc>
Inserts the text {string} in each line, to the right of the block
$A{string}<Esc>
Same as A{stri­ng}­<Es­c>, but will append the string in the lines that are shorter
C{string}<Esc>
Deletes the block and then throws you into Insert mode to enable you to type in a string

Search

/{pattern}
Search forwards
?{pattern}
Search backwards
n/N
Move to next/p­revious occurrence
<UP> and <DOWN>
Move through the history of search commands
*
Grab the word under the cursor and search forward
#
grab the word under the cursor and search backwards

Patterns

\
Escape special characters below to look for them
^
Matches the beginning of a line
$
Matches the end of a line
.
Matches any existing character

Substi­tution ranges

No range specified
Current line
%
All lines
{number}
Line
.
First line
$
Last line
- 0r + {number}
Line offset from range boundary
You can use a comma to specify an interval, .,$ means from the first line to the last line. You can also use patterns.

Substi­tution flags

No flag specified
First occurrence in range
g
All ocurrences in range
c
Ask for confir­mation before it performs each substi­tution

COMMAN­D-LINE mode

edit <fi­len­ame>
Edit new file, or load existing
q
Quit
q!
Quit and throw changes away
saveas <filename>
Save contents as <fi­len­ame> and continue editing
file <fi­len­ame>
Change current file name (does not write it)
substitute or s
Find and replace, in the form [range­]su­bst­itu­te/­fro­m/t­o/[­flags] (see substi­tution pannels)

Window commands

new
Open a window on a new, empty file above the current one
split
Open a new window above the current one. If file name is provided, opens a second window and starts editing the given file
close
Close current window
only
Closes all windows, except for the current one
Prepend v in new and split for a vertical split with a new window to the left
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Personal Neovim Cheatsheet Cheat Sheet
          My neovim Keyboard Shortcuts
          nvim cheat sheets Cheat Sheet

          More Cheat Sheets by marconlsantos

          Pragmatic Programming Cheat Sheet
          Basic Economics 1 : Prices And Markets Cheat Sheet
          Basic Economics 2 : Industry and Commerce Cheat Sheet