Neovim Lua Config, Keymaps, and Autocmds/Configure tabs and indentation

Set width and spacing rules.

Section: Lua options

Configure tabs and indentation

lua
lua
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
Explanation

A foundational code-style block for many projects.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Lua options
Enable line numbers
Turn on absolute and relative line numbers.
OpenIn sheetluasame section
Set the leader key
Define your custom mapping prefix.
OpenIn sheetluasame section
Map a save command
Bind a normal-mode key to save the file.
OpenIn sheetlua2 tag match
Create an autocmd
Run code when matching files are written.
OpenIn sheetlua2 tag match
Map Telescope file search
Bind a key to file-finding with a Lua callback.
OpenIn sheetlua2 tag match
Create an augroup
Group related autocmds together.
OpenIn sheetlua2 tag match