VIM

IT IS MODAL EDITOR (DIFFERENT OPERATING MODES)
- Normal mode (navigating around file)
i— Insert mode (pressescto return)r— Replace mode (pressescto return)v— Visual mode (pressescto return)- Line mode (keyboard control)
- Block mode (mouse control)
Commands
Normal mode
| Command | Description |
|---|---|
:q |
Quit a window |
:q! |
Quit entire vim |
:w |
Save file |
:w *.txt |
Save as new file |
/words |
Search for words in file |
n |
Select next match of pattern |
. |
Repeat the same editing |
ci |
Edit words inside parentheses |
| Command | Description |
|---|---|
h |
Move cursor left |
l |
Move cursor right |
j |
Move cursor down |
k |
Move cursor up |
u |
Undo the change |
y |
Copy a character |
yw |
Copy a word |
p |
Paste |
v |
Enable visual mode for text selection |
o |
Open a new line for editing |
| Command | Description |
|---|---|
b |
Move cursor back one word |
G |
Move to end of file |
g |
Move to beginning of file |
dw |
Delete a word |
ce |
Delete word and enter insert mode |
x |
Delete a character |
r |
Replace a character |
Insert mode
To move from Normal mode to Insert mode you can do the following:
- Press
s - Press
i - Press
gh
To escape back to normal mode use the Esc key.
Cite This Post
Auto-generated. Verify for your institution's requirements.