-- nvim/.config/nvim/lua/config/options.lua
-- Plain vim.opt settings. Nothing here should depend on a plugin.
local opt = vim.opt
-- Leader keys. Must be set before lazy.nvim loads anything.
vim.g.mapleader = " "
vim.g.maplocalleader = ","
-- UI
opt.number = true
opt.relativenumber = true
opt.signcolumn = "yes:1"
opt.cursorline = true
opt.scrolloff = 8
opt.sidescrolloff = 8
opt.wrap = false
opt.linebreak = true
opt.showmode = false -- lualine shows it
opt.laststatus = 3 -- one global statusline
opt.pumheight = 12
opt.cmdheight = 1
opt.termguicolors = true
opt.winminwidth = 5
opt.splitkeep = "screen"
opt.splitright = true
opt.splitbelow = true
-- Indent / whitespace
opt.expandtab = true
opt.shiftwidth = 2
opt.tabstop = 2
opt.softtabstop = 2
opt.smartindent = true
opt.shiftround = true
opt.list = true
opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
-- Search
opt.ignorecase = true
opt.smartcase = true
opt.hlsearch = true
opt.incsearch = true
opt.grepprg = "rg --vimgrep --smart-case"
opt.grepformat = "%f:%l:%c:%m"
-- Files / undo
opt.undofile = true
opt.undolevels = 10000
opt.swapfile = false
opt.backup = false
opt.writebackup = false
opt.autowrite = true
opt.confirm = true
-- Completion
opt.completeopt = { "menu", "menuone", "noselect" }
opt.wildmode = { "longest:full", "full" }
-- Performance
opt.updatetime = 250
opt.timeoutlen = 400
opt.redrawtime = 1500
opt.synmaxcol = 300
opt.lazyredraw = false
-- Folding (treesitter fills in expr later)
opt.foldmethod = "expr"
opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
opt.foldlevel = 99
opt.foldenable = true
opt.fillchars = { fold = " ", foldopen = "▾", foldclose = "▸", eob = " " }
-- Clipboard: keep ours for `"` and system for `+`/`*` when available.
if vim.fn.has("clipboard") == 1 then
opt.clipboard = "unnamedplus"
end
-- Disable a few providers I don't use to speed startup.
vim.g.loaded_ruby_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_python3_provider = 0
vim.g.loaded_node_provider = 0