How do I set Vim options on a per-file basis without changing my vimrc?
vim: set ts=2 sw=2 :
A modeline is a special comment embedded in a file that Vim reads to apply file-specific settings automatically.
vim: set ts=2 sw=2 :
A modeline is a special comment embedded in a file that Vim reads to apply file-specific settings automatically.
=
Pressing = in visual mode auto-indents the selected lines according to Vim's built-in indentation rules.
visual-mode #editing #visual-mode #indentation #formatting #productivity
~
The ~ command toggles the case of the character under the cursor — uppercase becomes lowercase and vice versa — then advances the cursor one position to the
gUiw
The gUiw command converts the entire word under the cursor to uppercase.
:set colorcolumn=80
The :set colorcolumn=80 command displays a vertical highlight at column 80, giving you a visual guide for line length.
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
gqip
The gqip command reformats the current paragraph to fit within the configured textwidth.
>>
The >> command shifts the current line one shiftwidth to the right, adding indentation.
J
The J command joins the current line with the line below it, replacing the newline with a space.
:g/^$/d
The :g/^$/d command deletes every blank line in the file using Vim's powerful global command.
gg=G
The gg=G command re-indents every line in the current file according to Vim's indentation rules.