Vim Command
(resources: https://vim.fandom.com/wiki/Moving_lines_up_or_down)
+jump to next lineGjump to last line of the fileoinsert new lineggVGselects all content. gg moves to first line. V starts visual mode. G jumps to last line thereby selecting from first to last lineTo go to first line of a file press
Escand chose one of the following:gg, or:1, or1G, or1gg
Ctrl o+0==> go to start of the line$==> go to end of file1+G==> jump to the first line2+G==> jump to the second lineo==> insert in a new linea==> insert after cursorA==> insert at the of the linei==> insert before cursorG+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 quotedw==> delete worddi"==> delete word within "da"==> delete word within " including the "dG==> delete from cursor until the end of the filed$==> delete from cursor until the end of the linexdelete character:s/toReplace/withWordin the line:%s/toReplace/withWordin the file:3,4s/toReplace/withWordbetween linesCntr+r==> redo/word==> find a word
Visual mode
Comment in/comment out
To comment in:
Press
EscPress
Ctrl-vSelect lines
Press
IInsert the character to put at the beginning of the line
Press
Esc
To comment out:
Press
Escpress
Ctrl-vSelect lines
Press
xPress
Esc
Select and delete
Go to the first line
Vmove down to last line
d
Last updated
Was this helpful?