Vim Command
Last updated
Was this helpful?
Last updated
Was this helpful?
(resources: )
+
jump to next line
G
jump to last line of the file
o
insert new line
ggVG
selects all content. gg moves to first line. V starts visual mode. G jumps to last line thereby selecting from first to last line
To go to first line of a file press Esc
and chose one of the following:
gg
, or
:1
, or
1G
, or
1gg
Ctrl o
+
0
==> go to start of the line
$
==> go to end of file
1
+ G
==> jump to the first line
2
+ G
==> jump to the second line
o
==> insert in a new line
a
==> insert after cursor
A
==> insert at the of the line
i
==> insert before cursor
G
+o
==> insert at the end of a file
vim + myfile.txt
==> insert at the end of a file (add an automatic G)
/" dt"
==> find the first quote and delete till next quote
dw
==> delete word
di"
==> delete word within "
da"
==> delete word within " including the "
dG
==> delete from cursor until the end of the file
d$
==> delete from cursor until the end of the line
x
delete character
:s/toReplace/withWord
in the line
:%s/toReplace/withWord
in the file
:3,4s/toReplace/withWord
between lines
Cntr
+ r
==> redo
/word
==> find a word
To comment in:
Press Esc
Press Ctrl-v
Select lines
Press I
Insert the character to put at the beginning of the line
Press Esc
To comment out:
Press Esc
press Ctrl-v
Select lines
Press x
Press Esc
Go to the first line
V
move down to last line
d