neovim-ide/dotfiles/.config/nvim/lua/options.lua

92 lines
4.0 KiB
Lua
Raw Normal View History

-- ── options.lua ───────────────────────────────────────────────────────────────
local o = vim.opt
local g = vim.g
-- Leader (set before plugins load)
g.mapleader = " "
g.maplocalleader = "\\"
-- ── Appearance ────────────────────────────────────────────────────────────────
-- termguicolors emits RGB escape codes. Termius on mobile renders these
-- as purple/magenta backgrounds. Disable when MOBILE=1.
o.termguicolors = (vim.env.MOBILE ~= "1")
o.number = true
o.relativenumber = true
o.cursorline = true
o.cursorcolumn = false
o.signcolumn = "yes:1"
o.scrolloff = 8
o.sidescrolloff = 8
o.wrap = false
o.showmode = false -- lualine handles this
o.showcmd = false
o.cmdheight = 1
o.pumheight = 12 -- max completion menu items
o.conceallevel = 0
-- ── Editing ───────────────────────────────────────────────────────────────────
o.expandtab = true
o.shiftwidth = 4
o.tabstop = 4
o.softtabstop = 4
o.smartindent = true
o.autoindent = true
o.breakindent = true
-- ── Search ────────────────────────────────────────────────────────────────────
o.ignorecase = true
o.smartcase = true
o.hlsearch = true
o.incsearch = true
-- ── Files ─────────────────────────────────────────────────────────────────────
o.undofile = true
o.undodir = vim.fn.stdpath("data") .. "/undo"
o.backup = false
o.swapfile = false
o.autoread = true
-- ── Behavior ──────────────────────────────────────────────────────────────────
o.clipboard = "unnamedplus"
o.updatetime = 250
o.timeoutlen = 300
o.splitright = true
o.splitbelow = true
o.completeopt = "menu,menuone,noselect"
o.mouse = "a"
o.virtualedit = "block"
-- ── Folding (treesitter) ──────────────────────────────────────────────────────
o.foldmethod = "expr"
o.foldexpr = "nvim_treesitter#foldexpr()"
o.foldenable = false -- open by default, fold manually
-- ── Netrw (disabled — using oil.nvim) ────────────────────────────────────────
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
-- ── Per-filetype tweaks ───────────────────────────────────────────────────────
vim.api.nvim_create_autocmd("FileType", {
pattern = { "lua", "json", "yaml", "toml" },
callback = function()
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
end,
})
-- Perl: use perltidy indenting convention
vim.api.nvim_create_autocmd("FileType", {
pattern = { "perl" },
callback = function()
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
end,
})
-- ── Highlight on yank ─────────────────────────────────────────────────────────
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 150 })
end,
})