VIM own cheatsheet
A append end
i insert
O insert one line above
o insert one line below
r change one character
p print some selection or paste something after dd
ce change the word
d2w remove two words
dd remove one line
d$ remove from cursor until end of line
x delete one charater similar to delete
m mark
ma mark a
0 go to beginning of the line
$ go to end of line
h left
j down
k up
l right
gg go to the beggining line of the file
G go to the end of the file
>> go one tab forward
<< go one tab backwards
u undo
ctrl+r redo
w go forward one word
b go backward one word
2w go forward 2 words
{ go forward one paragraph
} go backward one paragraph
:set sw=2 set tab spaces to 2
:ctrl-f show command histry
:! <command> run a command on the shell
:g do something globally
:.!ls paste ls output to the current cursor
:1!ls paste ls output to the first line
:p print
:!git status execute git status on another buffer
:. current cursor
:.,$ current to end
:'a,$ from mark a to end
:.,$!sort -u sort unique all lines from cursor to end
:'a,$p print on another buffer from mark a to end
:.,$s/str1/str2/g replace all occurences of str1 with str2 on lines from cursor to end
:1,100s/str1/str2/g replace all str1 with str2 on lines 1 to 100
:'a,'bs/str1/str2/g replace all str with str2 on mark a line to mark b line
:.,$!jq '.' pipe all lines from cursor to end to jq on another buffer
:Explore explore
:new newfile
:split split the window
:close close the buffer
:'a mark a
ctrl+n autocomplete tries to find similar string and completes it
'' will go to previous line
!! will open :.!
Copying
1. ma mark a
2. go down to until where you want to copy
3. y yank
4. 'a until a
5. p paste
On command line you can use vi mode by command
set -o vi
and revert it back using
set -o emacs