Vim Very powerful text editor. As a R&D engineer, you must be proficient in the vim command.
Vim is divided into three modes: Command Mode, Insert Mode and Last Line Mode.
The effects of these three modes are:
- Command Mode: Start vim, it enters the command mode, press i for insert mode
- Insert Mode: In the insert mode, some function keys can be used. ESC, exit insert mode, switch to command mode.
- Last Line Mode: In command mode, press : to enter the last line mode.
Linux vim workflow
![](https://www.linuxcommands.site/wp-content/uploads/2019/05/image-74.png)
Vim common shortcuts
h , ← | Cursor moves one character to the left |
j , ↓ | Cursor moves one character down |
k , ↑ | cursor moves up one character |
l , → | cursor moves one character to the right |
o | opens a line below the cursor and start Insert mode |
a | inserts text after the cursor |
e | command moves to the end of a word |
: x | save and exit |
:wq | save and exit |
:q! | trash all changes |
x | to delete the unwanted character |
u | undo the last the command and U to undo the whole line |
:s/old/new/g | substitute ‘new’ for ‘old’ where g is globally |
gg | move you to the start of the file |
G | move you to the bottom of the file |
v | starts visual mode |
dd | delete current line |
:set nu | display line number |