2.26. tool - vim (text editor)¶
Why use vim? - vim is installed on every linux machine, therefore knowing how to work it will ensure
that you are able to work any where. New machine, coworker’s machine, remote servers (where your favourite editor cannot be installed/used)
How to start vim on terminal:
vimorvim filename- By default vim opens in
command modeyou cannot edit the file from this mode to enter
insert modepressiorinsertkey. To get back tocommad modepressesc
- By default vim opens in
command window - write to file and quit:
:wqcommand window - quit without saving:
q!:command window - increase font size:
ctrl+=command window - decrease font size:
ctrl+-command window - add syntax highlighting
syntax onsyntax offcommand window - add line numbers
set numberset nonumbercommand window - jump to the beginning of a file
ggjump to the end of a fileshift+gcommand window - jump to a line number
:100to jump to line 100command window - undo last command
uinsert mode - increase indent:
ctrl+tinsert mode - decrease indent:
ctrl+d
In addition you can launch a vim tutorial in your terminal by typing vimtutor in your terminal
2.26.1. searching¶
enter
command windowtype
/followed by the character or string to search, ex:/hello worldthen pressenterpress
nto search forward orNto search backward