You need to be in command mode (pres Esc
for that) to use these commands.
1. Add a new line
Press o
(small) to add new line below cursor, or O
(big) to add new line above cursor.
2. Comment multiple lines
- Press
Ctrl + v
- Select lines with arrows keys
- Press
Shift + i
- Input commenting symbol(s) (e.g. "//")
- Press
Esc
3. Delete line
Press dd
to delete current line.
4. Delete word
Press dw
to delete current word (cursor should be placed at the beginning of the word to delete).
5. Disable line wrap:
:set nowrap
6. Enable autoindent
:set smartindent
7. Go to the end of current line
Press $
to to the end of line.
8. Go to the end of file
:$
9. Go to specific line
E.g. to go to line number 51:
:51
10. Open file in a new tab
:tabnew <filename>
More useful Vim commands, add your commands on Github.
Top comments (0)