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.
:nnoremap / :inoremap / :vnoremap
Vim has two types of key mappings: recursive (:map, :nmap, :imap) and non-recursive (:noremap, :nnoremap, :inoremap).
:set undofile
By default, Vim's undo history is lost when you close a file.
autocmd FileType {lang} setlocal {options}
Vim's autocmd FileType lets you apply settings that only take effect when editing a specific file type.
autocmd BufWritePre * :%s/\s\+$//e
By adding an autocmd for the BufWritePre event, you can make Vim automatically strip trailing whitespace from every line each time you save.
:ab teh the
Vim's abbreviation system automatically expands short text sequences as you type, making it perfect for auto-correcting typos, inserting boilerplate snippets, o
config #editing #insert-mode #config #productivity #auto-correct
:set paste
The :set paste command enables paste mode, which temporarily disables auto-indentation, smart tabs, and other insert-mode features that can mangle text pasted f
:set colorcolumn=80
The :set colorcolumn=80 command displays a vertical highlight at column 80, giving you a visual guide for line length.
:set relativenumber
The :set relativenumber command displays line numbers relative to the cursor position instead of absolute line numbers.
:set tabstop=4 shiftwidth=4 expandtab
The :set tabstop=4 shiftwidth=4 expandtab command configures Vim to use 4-space indentation with spaces instead of tab characters.
:set list
The :set list command makes invisible characters visible by displaying them as special symbols.
:set spell
The :set spell command activates Vim's built-in spell checker, which highlights misspelled words directly in your buffer.
:syntax on
The :syntax on command enables syntax highlighting in Vim, colorizing your code based on the file type.
:set number!
The :set number! command toggles line numbers on or off.