Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Vim Commands Cheat Sheet, Cheat Sheet of Operating Systems

In this cheat sheet you find all the main Vim commands

Typology: Cheat Sheet

2019/2020

Uploaded on 10/23/2020

ekaksha
ekaksha 🇺🇸

4.4

(30)

268 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Vim Commands Cheat Sheet
Marking
Moving
Moving by Screens
Inserting
Editing
Undoing/Redoing
Deleting
Visual Commands
Marks and Jumps
Multiple Files
*
#
/pattern
?pattern
n
N
Macros
Color Schemes
Searching
Copying
Cutting
Pasting
h
j
k
l
#h [j/k/l]
b / B
w / W
e / E
0 (zero)
$
^
#G / #gg / :#
move cursor left
move cursor down
move cursor up
move cursor right
move in a specified direction multiple
times
move to the start of a word / token
move to the start of the next word /
token
move to the end of a word / token
jump to the beginning of line
jump to the end of line
jump to the first (non-blank) character
of line
move to a specified line number
(replace # with the line number)
i
I
a
A
o
O
ea
Esc
switch to insert mode before the cursor
insert text at the beggining of the line
switch to insert mode after the cursor
insert text at the end of the line
open a new line below the current one
open a new line above the current one
insert text at the end of the word
exit insert mode
yy
#yy
yaw
yiw
y$
y^
ytx
yfx
copy an entire line
copy the specified number of lines
copy a word with its trailing whitespace
copy a word without its trailing
white-space
copy everything right of the cursor
copy everything left of the cursor
copy everything between the cursor
and a specified character (x)
copy everything between the cursor
and a specified character (including that
character)
m[a-z]
m[a-z]
`a
`y`a
`.
`"
`0
``
:marks
:jumps
:changes
Ctrl+i
Ctrl+o
g,
g;
marking text using character mode
[from a to z]
mark lines using line mode [from a to z]
jump to position marked a
yank text to position marked a
jump to last change in file
jump to last edit in file
jump to position where Vim was last
existed
jump to last jump
list all marks
list all jumps
list all changes
move to next instance in jump list
move to previous instance in jump list
move to next instance in change list
move to previous instance in change list
r
cc
C / c$
cw
s
J
gJ
.
replace a single character (+ return to
command mode)
replace entire line (+ move into insert
mode)
replace from cursor to the end of line
replace from cursor to the end of the
word
delete a character (+ move into insert
mode)
merge with line below, separated with a
single space
merge with line below, with no space
between
repeat last command
dd
#dd
d$
cut the entire line
cut a specified number of lines
everything right of the cursor
p
P
paste text after the cursor
paste text before the cursor
qa
q
@a
@@
record macro a
stop recording macro
run macro a
run last macro again
Ctrl+b
Ctrl+f
Ctrl+d
Ctrl+u
Ctrl+e
Ctrl+y
Ctrl+o
Ctrl+i
H
M
L
move back one full screen
move forward one full screen
move forward 1/2 a screen
move back 1/2 a screen
move screen down one line (without
moving cursor)
move screen up one line (without
moving cursor)
move backward through the jump
history
move forward through the jump
history
move to the top of the screen
move to the middle of the screen
move to the bottom of the screen
u / :u / :undo
#u
U
Ctrl+r
#Ctrl+r
:undolist
undo changes made in last entry
undo multiple changes
undo latest changes in line
redo the last undone entry
redo multiple changes
list undo branches
v
V
Ctrl+v
o
aw
ab
aB
at
ib
iB
it
marking text using character mode
mark lines using line mode
mark text using block mode
move from one end of the marked text
to the other
mark a word
mark a block with ()
mark a block with {}
mark a block with <>
mark inner block ()
mark inner block {}
mark inner block <>
:e file_name
:bn
:bp
:bd
:b#
:b file_name
:ls
:sp file_name
:vs file_name
:vert ba
:tab ba
gt
gT
Ctrl+ws
Ctrl+wv
Ctrl+ww
Ctrl+wq
Ctrl+wx
Ctrl+=
open a file in a new buffer
move to next buffer
go back to previous buffer
close buffer
move to the specified buffer (by
number)
move to the specified buffer (by name)
list all buffers
open a file in a new buffer and split
viewpoint horizontally
open a file in a new buffer and split
viewpoint vertically
edit all files as vertical viewports
edit all buffers as tabs
move to next tab
move to previous tab
split viewport horizontally
split viewport vertically
switch viewports
quit a viewport
exchange current viewport with next
one
make all viewports equal height and
width
jump to the next instance of a word
jump to the previous instance of a
word
search forward for the specified
pattern
search backward for the specified
pattern
repeat the search in the same
direction
repeat the search in the opposite
direction
dd / D
dw
#dd / d#d
:#,#d
:%d
:.,$d
dgg
:g /pattern/d
:g!/pattern/d
:g/^$/d
delete a single line
delete a single word
delete multiple lines
delete a range of lines
delete all lines
delete from current line to the end of
file
delete from current line to the
beggining of file
delete lines containing a specified
pattern
delete lines that don't contain a
specified pattern
delete all blank lines
y
d
p
u
U
yank (copy) the marked text
delete (cut) the marked text
paste the text after the cursor
change the marked text to lowercase
change the marked text to uppercase
:colorscheme [colorscheme_name]
:colorscheme [space]+Ctrl+d
change to
specified scheme
list available Vim
color scheme

Partial preview of the text

Download Vim Commands Cheat Sheet and more Cheat Sheet Operating Systems in PDF only on Docsity!

Vim Commands Cheat Sheet

Marking

Moving

Moving by Screens

Inserting

Editing

Undoing/Redoing

Deleting

Visual Commands

Marks and Jumps

Multiple Files

/pattern

?pattern

n

N

Macros

Color Schemes

Searching

Copying

Cutting

Pasting

h j k l #h [j/k/l] b / B w / W e / E 0 (zero) $ ^ #G / #gg / :#

move cursor left move cursor down move cursor up move cursor right move in a specified direction multiple times move to the start of a word / token move to the start of the next word /token move to the end of a word / token jump to the beginning of line jump to the end of line jump to the first (non-blank) character of line move to a specified line number (replace # with the line number)

i I a A o O

ea Esc

switch to insert mode before the cursor insert text at the beggining of the line switch to insert mode after the cursor insert text at the end of the line open a new line below the current one open a new line above the current one insert text at the end of the word exit insert mode

yy #yy yaw yiw y$ y^ ytx yfx

copy an entire line copy the specified number of lines copy a word with its trailing whitespace copy a word without its trailingwhite-space copy everything right of the cursor copy everything left of the cursor copy everything between the cursorand a specified character ( x ) copy everything between the cursorand a specified character (including that character)

m[a-z] m[a-z] aya. " `` :marks :jumps :changes Ctrl+i Ctrl+o g, g;

marking text using character mode [from a to z ] mark lines using line mode [from a to z ] jump to position marked a yank text to position marked a jump to last change in file jump to last edit in file jump to position where Vim was lastexisted jump to last jump list all marks list all jumps list all changes move to next instance in jump list move to previous instance in jump list move to next instance in change list move to previous instance in change list

r cc C / c$ cw s J gJ .

replace a single character (+ return tocommand mode) replace entire line (+ move into insertmode) replace from cursor to the end of line replace from cursor to the end of theword delete a character (+ move into insertmode) merge with line below, separated with asingle space merge with line below, with no spacebetween repeat last command

dd #dd d$

cut the entire line cut a specified number of lines everything right of the cursor

p P

paste text after the cursor paste text before the cursor^ qa q @a @@

record macro a stop recording macro run macro a run last macro again

Ctrl+b Ctrl+f Ctrl+d Ctrl+u Ctrl+e

Ctrl+y

Ctrl+o

Ctrl+i

H M L

move back one full screen move forward one full screen move forward 1/2 a screen move back 1/2 a screen move screen down one line (withoutmoving cursor) move screen up one line (withoutmoving cursor) move backward through the jumphistory move forward through the jumphistory move to the top of the screen move to the middle of the screen move to the bottom of the screen

u / :u / :undo #u U Ctrl+r #Ctrl+r :undolist

undo changes made in last entry undo multiple changes undo latest changes in line redo the last undone entry redo multiple changes list undo branches

v V Ctrl+v o aw ab aB at ib iB it

marking text using character mode mark lines using line mode mark text using block mode move from one end of the marked textto the other mark a word mark a block with () mark a block with {} mark a block with <> mark inner block () mark inner block {} mark inner block <>

:e file_name :bn :bp :bd :b# :b file_name :ls :sp file_name :vs file_name :vert ba :tab ba gt gT Ctrl+ws Ctrl+wv Ctrl+ww Ctrl+wq Ctrl+wx Ctrl+=

open a file in a new buffer move to next buffer go back to previous buffer close buffer move to the specified buffer (bynumber) move to the specified buffer (by name) list all buffers open a file in a new buffer and split viewpoint horizontally open a file in a new buffer and split viewpoint vertically edit all files as vertical viewports edit all buffers as tabs move to next tab move to previous tab split viewport horizontally split viewport vertically switch viewports quit a viewport exchange current viewport with nextone make all viewports equal height andwidth

jump to the next instance of a word jump to the previous instance of aword search forward for the specifiedpattern search backward for the specifiedpattern repeat the search in the samedirection repeat the search in the oppositedirection

dd / D dw #dd / d#d :#,#d :%d :.,$d dgg :g /pattern/d :g!/pattern/d :g/^$/d

delete a single line delete a single word delete multiple lines delete a range of lines delete all lines delete from current line to the end of file delete from current line to the beggining of file delete lines containing a specified pattern delete lines that don't contain a specified pattern delete all blank lines

y d p u U

yank (copy) the marked text delete (cut) the marked text paste the text after the cursor change the marked text to lowercase change the marked text to uppercase

:colorscheme [colorscheme_name] :colorscheme [space]+Ctrl+d

change tospecified scheme list available Vimcolor scheme