Common commands
Here a list of the most common vim commands
h (left)
j (down)
k(up)
l (right)
i (insert left to the cursors)
I (insert beginning of the line)
a (append right to the cursor)
A (append end of the line)
x (ex-out text)
r (replace a character)
o (insert line below current line
O (insert a line above current line)
dd (cut row)
yy (copy row)
p (paste)
w (next word)
e (end of the word)
b (begin of the word)
H (beginning of the screen)
L (end of the screen)
$ (end of line)
:$ (end of the file)
gg (first row)
G (last row)
0 (begin of the line)
d (delete text)
c (change text)
y and p (yank text and paste text)
v (select text in visual mode)
yiw (copy current word)
viw + y to select and copy
% - begin or end bracket
2dd (cut 2 lines)
10j (go down 10 lines)
10k (go up di 10 lines)
10G or :10 (go to line 10)
:set nu (set line number)
:noh (delete hightlight)
Change git default editor to vim
git config --global core.editor vim
Comment out with # from line 10 to line 110
:10,110s/^/\#/g
Search
:/ (search forward)
:? (search backward)
###### once searched then...
n (next occurrence forward)
N (next word occurrence backward)
###### escape
\ is used as escape character
###### example
To find "http://mysite.com" inside a text
:/http:\/\/mysite.com
0 Comments