|Visual mode||Shift + v|
|Visual block Mode||Ctrl + v|
|go to line 55||55 gg|
|G||Go to the end of the document|
- Comment: Go into visual block mode
- shift-i to insert, add a # (or any other comment sign)
- the symbol appears in the first line
- esc and it gets copied on every line (it happens only after the -esc !!)
- Uncomment: Select in visual block mode and delete.
In normal mode, type
>> to indent the current line, or
<< to unindent. Each command can be used with a count. The operators
< do the same for motions, text objects and visual selections. For all commands, pressing
. repeats the operation.
For example, typing
5>>.. shifts five lines to the right, and then repeats the operation twice so that the five lines are shifted three times.
In insert mode,
Ctrl-T indents the current line, and
When indenting or unindenting, lines are shifted one
'shiftwidth' to the right or left.
- % indicates the entire file
- s is for “substitute” (or only search)
- g global, replace all occurrences in the line (not only the first)
:[range]s/search/replace/ :8,10 s/search/replace/g :%s/search/replace/g :%s/stretch/buster/g
Replace backslah (\) with slash (/)
syntax on set background=dark :command W w :command Q q
Add comment to file for indentation and stuff
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet