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 โ€” Neovim ships 365, Vim 442, and they overlap heavily. Every vimrc is mostly :set calls. The syntax is consistent once you learn the conventions. For the full list of every option in both editors, see Complete Options Reference.

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, Complete Options Reference