- Normal
- Edit/Insert
- Visual
- Replace
Alphanumeric keys can not be used to edit open code. We can use commands to manipulate content of open file.
This is default mode.
j - down
k - up
h - left
l - right
2k - Go 2 line up from cursor - Similar with other navigations
w - next word end
W - Next word start
e - End of the next word
b - last word
B - last word begin
/nginx - Find first occurrence of nginx after cursor
?nginx - Find first occurrence of nginx before cursor
:12 - Go to line number
$ - Beginning of the current line
0 - end of the current line
G - go to last line
gg - go to first line
2k- Go 2 line up from cursor5j- go 4 lines down from the cursor
with i we can start using alphanumeric keys to edit our code/lines file
I - Insert at the beginning of the line/Goto beginning of the line
A - Append insert at the end of the line
a - append after at the cursor
i - Insert before at the cursor
ESC + u * keep going back to previous changes
We can edit/select lines/code with commands without using mouse.
Enter into the visual mode: small v, capital V,
v - selects the characters -> up down left right
dto remove selected characted
V - selects the whole current line
dto remove selected lines
ctrl + v (not command + v of mac )- Enters into visual mode with first character selected only -> right + up + down
- Useful to correct the multiple lines indentations
>> - shift right
<< - shift left
Multiple Lines indentation -> V + >>
Same as visual mode, though we can replace patterns with this command.
R - Start replacing the characters from the cursor
r - replaces the current characted with entering into replace mode
c - change (paste)
d - delete (probably cut)
y - yank (copy)
c + w -> replace the current word + get into the insert mode