How do I temporarily set a Vim option?
Answer
:set option
Explanation
The :set command changes Vim options for the current session. Options can be boolean (on/off), numeric, or string values.
How it works
:set numberenables line numbers:set nonumberdisables line numbers:set number!toggles line numbers:set number?queries the current value
Example
:set number " Enable line numbers
:set tabstop=4 " Set tab width to 4
:set wrap! " Toggle line wrapping
:set filetype? " Show current filetype
Tips
:setlocalsets the option only for the current buffer/window:set allshows all option values:set option&resets an option to its default- Add options to your vimrc for permanent settings
- Use Tab completion after
:setfor option names