vim is installed by default
basic vim usage¶
the most vim-style way of getting help for
vim is starting vim and entering
for doing some basic editing the following sequences should be enough.
One edits a file in
vim by issuing the command:
The vim editor has three modes:
- command mode letters or sequence of letters interactively command vim. Commands are case sensitive. The ESC key can end a command.
- insert mode Text is inserted. The ESC key ends insert mode and returns you to command mode. One can enter insert mode with the "i" (insert), "a" (insert after), "A" (insert at end of line), "o" (open new line after current line) or "O" (Open line above current line) commands.
- command line mode One enters this mode by typing ":" which puts the command line entry at the foot of the screen.
|x||delete character under cursor|
|dd||delete current line|
|yy||copy (yank) current line|
edit text freely, press
<ESC> when you are finished.
command line mode¶
|:q!<enter>||exit w/o saving|
|:wq<enter>||exit w/ saving|
|:/foo|| search for
|:?bar|| search for
|n||after search, go to next occurrence|
|N||after search, go to previous occurrence|
|:%s/foo/bar/gc|| replace all