Setting Options (:set)

How options work, and the conventions you'll see in every vimrc.

Keys: :set

:set toggles or assigns options. :set option turns it on; :set nooption turns it off; :set option! toggles; :set option=value assigns; :set option? queries.

Setting Options

Options are Vim's settings โ€” there are over 300. Every vimrc is mostly :set calls. The syntax is consistent once you learn the conventions.

Form Effect
:set Show options that differ from defaults
:set all Show all options
:set nu Turn ON option nu (number)
:set nonu Turn OFF (prefix no)
:set nu! Toggle
:set nu? Query current value
:set ts=4 Assign 4 to numeric option ts
:set fo+=t Append t to option fo
:set fo-=t Remove t
:set fo& Reset to default
:setlocal nu Set for THIS buffer/window only
:verbose set ts? Show value AND where it was last set

Watch

See also: Vim Configuration