From :h options.txt:

Vim has a number of internal variables and switches which can be set to achieve special effects. These options come in three forms:

  • boolean can only be on or off
  • number has a numeric value
  • string has a string value

Here are examples for each of these forms:

  • :set cursorline highlight the line containing the cursor
  • :set history=200 increase default history from 50 to 200
  • :set ww+=[,] allow left and right arrow keys to move across lines in Insert mode
    • += allows you to append to an existing string value

Usage guidelines:

  • set {option} switch on the given boolean setting
    • :set expandtab use spaces for tab expansion
  • set {option}! toggle the given boolean setting
    • :set expandtab! if previously tabs were expanded, it will be turned off and vice versa
    • set inv{option} can also be used
  • set no{option} switch off the given boolean setting
    • :set noexpandtab disable expanding tab to spaces
  • set {option}? get the current value of the given option (works for all three forms)
    • :set expandtab? output will be expandtab or noexpandtab depending on whether it is switched on or off
  • set {option} get the current value of number or string option
    • for example, try :set history or :set ww

info See :h options.txt for complete list of usage guidelines and available options.

Video demo:


info See also my Vim Reference Guide and curated list of resources for Vim.