Skip to main content

Options Reference

Neovim has hundreds of settings. This lesson covers the most impactful options for daily development, organized by category.

Setting Options in Lua

-- Global option
vim.opt.number = true

-- Buffer-local option
vim.bo.tabstop = 4

-- Window-local option
vim.wo.wrap = false

-- Access current value
print(vim.opt.number:get())
print(vim.o.tabstop) -- global shortcut

Display Options

OptionRecommendedDescription
numbertrueShow line numbers
relativenumbertrueShow relative line numbers
cursorlinetrueHighlight current line
termguicolorstrueEnable 24-bit color
signcolumn"yes"Always show sign column (prevents layout shift)
colorcolumn"80"Show ruler at column 80
wrapfalseDisable line wrapping
linebreaktrueIf wrap enabled, break at word boundaries
showmodefalseDon't show "-- INSERT --" (use statusline instead)
scrolloff8Keep N lines visible above/below cursor
sidescrolloff8Keep N cols visible left/right
conceallevel2Conceal markdown syntax (for markdown editing)
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.termguicolors = true
vim.opt.signcolumn = "yes"
vim.opt.colorcolumn = "80"
vim.opt.wrap = false
vim.opt.scrolloff = 8
vim.opt.showmode = false

Indentation Options

OptionRecommendedDescription
tabstop2 or 4Width of a tab character
shiftwidthsame as tabstopWidth for >> / << indent
softtabstopsame as tabstopTab key inserts N spaces
expandtabtrueUse spaces instead of tabs
autoindenttrueAuto-indent new lines
smartindenttrueSmart auto-indenting
shiftroundtrueRound indent to multiple of shiftwidth
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.shiftround = true

Search Options

OptionRecommendedDescription
ignorecasetrueCase-insensitive search
smartcasetrueSwitch to case-sensitive if uppercase
incsearchtrueIncremental search (show as you type)
hlsearchtrueHighlight all search results
inccommand"split"Live preview of substitute command
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.incsearch = true
vim.opt.hlsearch = true
vim.opt.inccommand = "split"

File and Encoding Options

OptionRecommendedDescription
encoding"utf-8"Internal encoding
fileencoding"utf-8"File encoding on disk
undofiletruePersist undo history across sessions
swapfilefalseNo swap files
backupfalseNo backup files
writebackupfalseNo write backup
autoreadtrueAuto-reload files changed outside Neovim
vim.opt.encoding = "utf-8"
vim.opt.fileencoding = "utf-8"
vim.opt.undofile = true
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.autoread = true

Performance and Timing Options

OptionRecommendedDescription
updatetime300Milliseconds before CursorHold events (lower = faster LSP)
timeoutlen300Key sequence timeout (ms)
ttimeoutlen0Terminal key sequence timeout
lazyredrawfalseDon't redraw during macros (can cause issues with some plugins)
synmaxcol300Max column for syntax highlighting (performance)
vim.opt.updatetime = 300
vim.opt.timeoutlen = 300
vim.opt.ttimeoutlen = 0

Completion Options

OptionRecommendedDescription
completeopt"menu,menuone,noselect"Completion menu behavior
pumheight10Max items in popup menu
shortmess:ctrueDon't show completion messages
vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.pumheight = 10
vim.opt.shortmess:append("c")

Split and Window Options

OptionRecommendedDescription
splitrighttrueVertical splits open right
splitbelowtrueHorizontal splits open below
equalalwaysfalseDon't auto-equalize splits
vim.opt.splitright = true
vim.opt.splitbelow = true

Clipboard

-- Sync Neovim clipboard with system clipboard
vim.opt.clipboard = "unnamedplus"
warning

Setting clipboard = "unnamedplus" means every yank/delete updates the system clipboard. If you don't want this, use "+y explicitly when you want to copy to clipboard.

Wild Menu (Command Completion)

vim.opt.wildmenu = true
vim.opt.wildmode = "longest:full,full"
vim.opt.wildignore:append({
"*.pyc", "*.o", "*.class", "node_modules/**",
".git/**", ".DS_Store", "*.swp",
})

Filetype-Specific Overrides

Use autocmds to override per filetype:

~/.config/nvim/lua/config/autocmds.lua
vim.api.nvim_create_autocmd("FileType", {
pattern = { "python" },
callback = function()
vim.bo.tabstop = 4
vim.bo.shiftwidth = 4
end,
})

vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "txt" },
callback = function()
vim.wo.wrap = true
vim.wo.linebreak = true
vim.wo.spell = true
end,
})

What's Next