These commands work in command mode.
Esc
is used to exit insert mode and enter command mode.
1. Move Cursor
j - down
k - up
h - left
l - right
8j - 8 lines down
8k - 8 lines up
gg - top
G - bottom
w - move forward one word
b - move backward one word
2. Enter into INSERT mode
i - insert before the current character
I - insert at the beginning of the line
a - inset after the current character
A - insert at the end of the line
o - insert next to the current line
O ( not zero) - insert before the current line
3. Exit Vim
:q - exit if no change are made
:q! - exit and ignore the change made
:wq - write the change and then exit
:w new_name - save the file with the new name
ZZ - Write the current file, if modified, and exit.
4. Deleting Text
x - delete the current character
dd - delete the current line
5. Copy Paste
yy - copy the current line **to the store buffer**
p - paste after the current line ** from the storage buffer **
P - paster before the current line
Vim copy and pastes to and from the storage buffer and not the system clipboard
If you want to use the system clipboard then just enter in to insert mode and to copy select the text and press
ctrl + c
and to paste pressctrl + v
6. Undo and redo
u - Undo the last operation
CTRL + r - redo the last undo
Did you find this article valuable?
Support Harshit Saini by becoming a sponsor. Any amount is appreciated!