vi filename.txt
- Open a file:
- Enter Command Modeu
- Undo changesctrl+u
- Redo Changes:q
- Quit Vim:q!
- Force quit vim without saving:w
- Save file:wq
- Save file and quit
d4j
- Delete 4 lines from current position including current positiond4k
- Delete 4 lines before current position including current positiondd4
- Delete 4 lines
0
- Start of the line$
- End of the linegg
- Top of documentG
- Bottom of document4j
- Move to 4th line from current position4k
- Move to 4the line before current position
yy
- copy a linep
- paste a line
-
:/hello
- Serach hello and hit enter -
n
- move to Next match -
N
- move to Previous match -
:%s/hello/helloworld/g
- Search and replace hello with helloworld in all places -
:%s/hello/helloworld/gc
-- Search and replace hello with helloworld in all places by confirming