0% found this document useful (0 votes)
534 views41 pages

Neovim Tutorial - QWERTY

This document provides a 3-sentence summary of the neovim/vim graphical cheat sheet: The cheat sheet outlines keyboard shortcuts and commands for neovim/vim's normal and visual modes, including motions, operators, commands, and special functions, as well as ex commands that can be run from the command line. Common shortcuts are shown for actions like moving the cursor, editing text, searching, and undoing/redoing changes. The cheat sheet is intended as a quick reference for basic and intermediate neovim/vim commands.

Uploaded by

air_bugz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
534 views41 pages

Neovim Tutorial - QWERTY

This document provides a 3-sentence summary of the neovim/vim graphical cheat sheet: The cheat sheet outlines keyboard shortcuts and commands for neovim/vim's normal and visual modes, including motions, operators, commands, and special functions, as well as ex commands that can be run from the command line. Common shortcuts are shown for actions like moving the cursor, editing text, searching, and undoing/redoing changes. The cheat sheet is intended as a quick reference for basic and intermediate neovim/vim commands.

Uploaded by

air_bugz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 41

version 2.

2
October 7th, 2018 neovim/vim gr
Esc
normal
mode

~ toggle
case ! external
filter @· play
macro # prev
ident $ eol % goto
match

`· goto
mark 1 2
2 3 4 5
Q ex
mode W next
WORD E end
WORD R replace
mode T·
q· record
macro w next
word e end
word r· replace
char t·
A append
eol
at
S subst
line D delete
to eol F· find
"back"
char

a append s d f· char
1,3
subst delete find
char

Z· quit
4
X back-
space C change
to eol V visual
lines

z· extra
cmds
5
x delete
char c change
1,3
v visual
mode

moves the cursor, or defines


motion
the range for an operator

direct action command,


command
if red , it enters insert mode

requires a motion afterwards,


operator
operates between cursor & destination

special functions,
extra
requires exta input
q· commands with a dot need
a char argument afterwards

bol = beginning of line, eol = end of line,


mk = mark, yank = copy, char = character
parag = paragraph, cmd = command

words: q u u x ( f o o , b a r , b a z )

WORDs: q u u x ( f o o , b a r , b a z )

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
m/vim graphical cheat sheet

goto
match ^ "soft"
bol & repeat
:s * next
ident ( begin
sentence ) end
sentence _
6 7 8 9 0 "hard"
bol -
T· back
'till Y yank
line U undo
line I insert
at bol O open
above P paste
before

t· y u i o p 1
1,3 insert open paste
'till yank undo
mode below after

G· gotoeof/line H screen
top J join
lines K help L screen
bottom : ex cmd
line

g· extra
cmds
6
h ⬅ j ⬇ k ⬆ l ➡ ; repeat
t/T/f/F

visual
lines B back
WORD N prev
(find) M screen
mid'l < indent
un- 3
> indent
3

visual
mode b back
word n next
(find) m· set
mark , reverse
t/T/f/F . repeat
cmd /·

Main command line commands ('ex'): Notes:


:w (save), :q (quit), :q! (quit w/o saving) (1) use "x before a yank/paste/del command
:e f (open file f) to use that register ('clipboard') (x=a..z,*)
:%s/x/y/g (replace 'x' by 'y' filewide), (e.g.: "ay$ to copy rest of line to register 'a')
:h (help in neovim), :new (new file in neovim)
(2) type in a number before any action
Other important commands: to repeat it that number of times
& destination CTRL-R: redo (e.g.: 2p, d2w, 5i, d4j)
CTRL-F/-B: page up/down,
CTRL-E/-Y: scroll line up/down, (3) duplicate operator to act on current line
CTRL-V: block-visual mode (dd = delete line, yy = yank line, >> = indent
Visual mode: (4) ZZ to save & quit, ZQ to quit w/o saving
Move around and type operator to act
on selected region (5) zt: scroll cursor to top,
zb: bottom, zz:center

(6) gg: top of file,


gf: open file under cursor
;

Emu, vi/vim emulation for Microsoft Visual Studio


_ "soft" bol
down + next
line

- prev
line = auto 3
format

{ begin
parag } end
parag

[· misc ]· misc

ex cmd
line "· spec
reg. 1
| bol/
goto col

repeat
t/T/f/F '· mk.gotobol \· default
leader

find
(rev.)

find

/paste/del command
clipboard') (x=a..z,*)
st of line to register 'a')

ore any action


ber of times

o act on current line


= yank line, >> = indent line)
to quit w/o saving
version 2.2
October 7th, 2018
neovim/vim les
Esc
normal
mode

$ eol

W next
WORD E end
WORD R replace
mode

w next
word e end
word

A append
eol
at

X back-
space

x delete
char

Basics: Extras:

h j k l are neovim cursor keys - use them as they are much u to undo the last action
closer than regular cursor keys! undo (CTRL-

Use i to enter insert mode, cursor turns from a block into a vertical 0 jumps directly to the
line, and you can type in text. U Esc to return to normal mode. and ^ to the first non-b

Use x to delete the current character, X to delete the one to Use w b e


the left alphanumeric or punctu
Use A to go insert text at the end of the line (wherever you are Use W B E
in the line!) any non-blank character

(Note: insert mode is actually very similar to a regular editor, you can use Use R to enter insert m
cursor/navigation keys, backspace, delete...) types over existing char

: w and press enter to s

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
m/vim lesson 1 - basic editing

^ "soft"
bol

0 "hard"
bol

u undo i insert
mode

: ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

B back
WORD

b back
word

moves the cursor, or defi


motion the range for an operator

direct action command,


to undo the last action - neovim supports unlimited command if red, it enters insert mo
R to redo)

jumps directly to the beginning of the li $ to the end,


to the first non-blank

to move along 'words'. A 'word' is a sequence of all


lphanumeric or punctuation signsq u u x ( f o o , b a r , b a z ) ;
to move along 'WORDs'. A 'WORD' is a sequence of
ny non-blank characters: q u u x ( f o o , b a r , b a z ) ;

to enter insert mode with an overstrike cursor, which


ypes over existing characters.

and press enter to save, : q and enter to quit.

Emu, vi/vim emulation for Microsoft Visual Studio


ex cmd
line

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode
version 2.2
October 7th, 2018 neovim/vim lesson 2
Esc
normal
mode

$ eol

1 2 3 4 5
W next
WORD E end
WORD R replace
mode T·
w next
word e end
word t·
A append
eol
at
F· find
"back"
char

d delete f· char
find

X back-
space V visual
lines

x delete
char c change v visual
mode

Basics: Extras:

f , followed by another key, moves the cursor to the next instance Prepend a count to any
of that character on the current lin F does the same backwards. of times:

t and T do the same, but they stop right before the character. d 2 w to delete up to th
d 2 t , to delete up to
d (delete) followed by any motion, deletes the text between the 2 i repeats the text aft
cursor and that motion's destinati ( d w , d f - ...).
Repeat operator
c (change) does the same, but leaves you in insert mode.
V enters visual-lines mo
Some motions, such as j and k , are linewise - deletion includes
the full start/end lines. CTRL- v selects rectang

. repeats the last editing action: text input, delete or change, etc...
motion is recalculated at the new place.

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
m lesson 2 - operators & repetition

^ "soft"
bol

6 7 8 9 0 "hard"
bol

T· back
'till

t· 'till u undo i insert


mode

: ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

visual
lines B back
WORD

visual
mode b back
word . repeat
cmd

learned in previous lesso


learned

moves the cursor, or defi


repend a count to any command/motion to repeat it that number motion the range for an operator

direct action command,


command if red, it enters insert mo
to delete up to the second word.
requires a motion afterw
to delete up to, but not including, the second comma. operator operates between cursor
repeats the text after you press (Esc) to finish the input session.

epeat operator c c or d d ) to operate on the current line.


enters visual-lines mode - lik v , but selecting whole lines.

selects rectangular blocks.

Emu, vi/vim emulation for Microsoft Visual Studio


ex cmd
line

learned in previous lessons

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode

requires a motion afterwards,


operates between cursor & destination
version 2.2
October 7th, 2018 neovim/vim lesso
Esc
normal
mode

$ eol

1 2 3 4 5
W next
WORD E end
WORD R replace
mode T·
w next
word e end
word t·
A append
eol
at
F· find
"back"
char

d delete f· char
find

X back-
space V visual
lines

x delete
char c change v visual
mode

Basics: Extras:

Use y followed by any motion to 'yank' (copy). " and an a


chooses a register.
Use p to paste after (if charwise, to the right; if linewise, below).
An A- Z
Use P to paste before.
" * or "
y y copies the current line.
y also works in visual mode. o enters insert mode in

Text deleted withy , c , x ... is also copied! O does the same above

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
/vim lesson 3 - yank and paste

^ "soft"
bol

6 7 8 9 0 "hard"
bol

T· back
'till O open
above P paste
before

t· 'till y yank u undo i insert


mode o open
below p paste
after

: ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

visual
lines B back
WORD

visual
mode b back
word . repeat
cmd

learned in previous lesso


learned

moves the cursor, or defi


- z character before any yank/delete/paste command motion the range for an operator
hooses a register.
direct action command,
command if red, it enters insert mo
register before you yank/delete means you "append-copy".
requires a motion afterw
operator operates between cursor
+ select the system clipboard.
special functions,
extra requires extra input
enters insert mode in a new empty line below the current one.

does the same above the current line.

Emu, vi/vim emulation for Microsoft Visual Studio


ex cmd
line "· reg.
spec

learned in previous lessons

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode

requires a motion afterwards,


operates between cursor & destination

special functions,
requires extra input
version 2.2
October 7th, 2018 neovim/vim le
Esc
normal
mode

# prev
ident $ eol

1 2 3 4 5
W next
WORD E end
WORD R replace
mode T·
w next
word e end
word t·
A append
eol
at
F· find
"back"
char

d delete f· char
find

X back-
space V visual
lines

x delete
char c change v visual
mode

Basics: Extras:

/ is the basic search motion - type the text you are searching for The following very usefu
after the slash, and the press return. Being a motion, you can use
this after an operator, or in visual mode. * searches forward for
the cursor.
? does the same, backwards.
# does the same backw
n repeats the last search in the same direction
N repeats it in the reverse direction

Be careful, because the search target is interpreted as a regular


expression: a*b means one or more 'a's followed by a 'b', ^abc
means 'abc' at the beginning of a line, [0-9] looks for the next
digit, etc...

Warning: vim and neovim do not use POSIX regex by default


Read about the 'magic' settings to rectify the situation here:
http://vim.wikia.com/wiki/Simplifying_regular_expressions_using_magic_and_no-magic

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
im/vim lesson 4 - searching

^ "soft"
bol * next
ident

6 7 8 9 0 "hard"
bol

T· back
'till O open
above P paste
before

t· 'till y yank u undo i insert


mode o open
below p paste
after

: ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

visual
lines B back
WORD N prev
(find) ?·
visual
mode b back
word n next
(find) . repeat
cmd /·

learned in previous lesso


learned

moves the cursor, or defi


he following very useful motions do not work in vi motion the range for an operator

direct action command,


searches forward for the next instance of the identifier under command if red, it enters insert mo

requires a motion afterw


operator operates between cursor
does the same backwards.
special functions,
extra requires extra input
Emu, vi/vim emulation for Microsoft Visual Studio
ex cmd
line "· reg.
spec

find
(rev.)

find

learned in previous lessons

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode

requires a motion afterwards,


operates between cursor & destination

special functions,
requires extra input
version 2.2
October 7th, 2018 neovim/vim lesso
Esc
normal
mode

@· play
macro # prev
ident $ eol

`· goto
mark 1 2 3 4 5
W next
WORD E end
WORD R replace
mode T·
q· record
macro w next
word e end
word t·
A append
eol
at
F· find
"back"
char

d delete f· char
find

X back-
space V visual
lines

x delete
char c change v visual
mode

Marks: Macros:

Use m followed by an a - z character to set a mark. Use q followed by an

Use ` followed by a character to go to that mark. Use q afterwards to sto

Use ' and a character to go to the first non-blank in that line. @ followed by a charact

A- Z marks are global, a - z per-buffer. @ @ to repeat the last m


` . refers to the position of the last modification

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
/vim lesson 5 - marks & macros

^ "soft"
bol * next
ident

6 7 8 9 0 "hard"
bol

T· back
'till O open
above P paste
before

t· 'till y yank u undo i insert


mode o open
below p paste
after

: ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

visual
lines B back
WORD N prev
(find) ?·
visual
mode b back
word n next
(find) m· set
mark . repeat
cmd /·

learned in previous lesso


learned

moves the cursor, or defi


followed by an a - z character to start recording motion the range for an operator

direct action command,


afterwards to stop recording. command if red, it enters insert mo

requires a motion afterw


followed by a character replays that macro. operator operates between cursor

special functions,
to repeat the last macro played. extra requires extra input
Emu, vi/vim emulation for Microsoft Visual Studio
ex cmd
line "· reg.
spec

'· goto
mk. bol

find
(rev.)

find

learned in previous lessons

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode

requires a motion afterwards,


operates between cursor & destination

special functions,
requires extra input
version 2.2
October 7th, 2018 neovim/vim lesso
Esc
normal
mode

@· play
macro # prev
ident $ eol % goto
match

`· goto
mark 1 2 3 4 5
W next
WORD E end
WORD R replace
mode T·
q· record
macro w next
word e end
word t·
A append
eol
at
F· find
"back"
char

d delete f· char
find

X back-
space V visual
lines

x delete
char c change v visual
mode

% jumps between matching pairs of ( ), [ ], etc... ( and ) jump to the be

H M L jump directly to the top/middle/bottom of the screen. { and } jump to the pr

G jumps to the end of the file, or to the line # typed before it. [ [ jumps to the previo

- / + jump to the previous/next line. ] ] jumps to the next '{

K , not technically a motion, jumps to the help for the word under
the cursor: neovim help, man page, etc...
Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet
Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
/vim lesson 6 - various motions

goto
match ^ "soft"
bol * next
ident ( begin
sentence ) end
sentence

6 7 8 9 0 "hard"
bol -
T· back
'till O open
above P paste
before

t· 'till y yank u undo i insert


mode o open
below p paste
after

G· gotoeof/line H screen
top K help L screen
bottom : ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

visual
lines B back
WORD N prev
(find) M screen
mid'l ?·
visual
mode b back
word n next
(find) m· set
mark . repeat
cmd /·

learned in previous lesso


jump to the beginning/end of the current sentence. learned

moves the cursor, or defi


jump to the previous/next empty line. motion the range for an operator

direct action command,


jumps to the previous '{' in the first column command if red, it enters insert mo

requires a motion afterw


jumps to the next '{' in the first column operator operates between cursor

special functions,
extra requires extra input
Emu, vi/vim emulation for Microsoft Visual Studio
+ next
line

- prev
line

{ begin
parag } end
parag

[· misc ]· misc

ex cmd
line "· reg.
spec

'· goto
mk. bol

find
(rev.)

find

learned in previous lessons

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode

requires a motion afterwards,


operates between cursor & destination

special functions,
requires extra input
version 2.2
October 7th, 2018 neovim/vim lesson
Esc
normal
mode

~ toggle
case @· play
macro # prev
ident $ eol % goto
match

`· goto
mark 1 2 3 4 5
W next
WORD E end
WORD R replace
mode T·
q· record
macro w next
word e end
word r· replace
char t·
A append
eol
at
S subst
line D delete
to eol F· find
"back"
char

s subst
char d delete f· char
find

X back-
space C change
to eol V visual
lines

x delete
char c change v visual
mode

Basics: Extras:

J joins the current line with the next one, or all the lines in the > and a motion to inden
current visual selection.
< and a motion to unind
r followed by any character replaces the current character with
that one. = and a motion to refor

C is shorthand for c $ , changes to end of line. All of them work in visu


to operate on the curren
D is shorthand for d $ , deletes to end of line.
~ toggles the case of the
Y is shorthand for y y , yanks the whole line.

s deletes the character under the cursor and enters insert mode. Now go grab the fu
Start with
S clears the current line and enters insert mode.

Google Doc version by mattmc3 https://github.com/mattmc3/neovim-cheatsheet


Credit to www.viemu.com for design For tutorial and fulll cheat sheets, go to www.viemu.com - home of ViEmu, vi/vim emulation for Micr
im lesson 7 - various commands

goto
match ^ "soft"
bol * next
ident ( begin
sentence ) end
sentence

6 7 8 9 0 "hard"
bol -
T· back
'till Y yank
line O open
above P paste
before

t· 'till y yank u undo i insert


mode o open
below p paste
after

G· gotoeof/line H screen
top J join
lines K help L screen
bottom : ex cmd
line

h ⬅ j ⬇ k ⬆ l ➡

visual
lines B back
WORD N prev
(find) M screen
mid'l < un-
indent > indent ?·
visual
mode b back
word n next
(find) m· set
mark . repeat
cmd /·

learned in previous lesso


learned

moves the cursor, or defi


and a motion to indent one or more lines. motion the range for an operator

direct action command,


and a motion to unindent command if red, it enters insert mo

requires a motion afterw


and a motion to reformat a range of text. operator operates between cursor

special functions,
ll of them work in visual mode, or can be repeated > > , etc...) extra requires extra input
o operate on the current line.
toggles the case of the character under the cursor.

Now go grab the full cheat sheet and learn the rest.
Start with I a , and ; . Piece of cake!

Emu, vi/vim emulation for Microsoft Visual Studio


+ next
line

- prev
line = auto
format

{ begin
parag } end
parag

[· misc ]· misc

ex cmd
line "· reg.
spec

'· goto
mk. bol

find
(rev.)

find

learned in previous lessons

moves the cursor, or defines


the range for an operator

direct action command,


if red, it enters insert mode

requires a motion afterwards,


operates between cursor & destination

special functions,
requires extra input

You might also like