Files
nvim/lua/core/options.lua
T
2026-04-27 07:09:41 +02:00

131 lines
3.7 KiB
Lua

vim.opt.cursorline = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.mousemodel = "popup"
vim.opt.fillchars = {
diff = " ",
horiz = "",
horizup = "",
horizdown = "",
vert = "",
vertleft = "",
vertright = "",
verthoriz = "",
}
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.smarttab = false
-- Folds are configured in nvim-treesitter, so this is only for fallback
vim.opt.foldenable = false
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldmethod = "indent"
vim.opt.foldignore = ""
---@diagnostic disable-next-line: assign-type-mismatch
vim.opt.completeopt = {
"menu",
"menuone",
"noinsert",
"noselect",
}
vim.opt.complete = { "o" }
-- set nowrap
vim.opt.matchpairs:append({ "<:>" })
-- Only relevant with wrap enabled (default)
vim.opt.linebreak = true
vim.opt.breakindent = true
vim.opt.showbreak = " "
-- Minimum amount of lines to show offset +/- to cursorline
vim.opt.scrolloff = 3
vim.opt.visualbell = true
vim.opt.errorbells = false
-- Persistent undo even after you close a file and re-open it
vim.opt.undofile = true
-- Bound shada size: cap oldfiles/marks at 20 files and history at 100 entries
-- each (otherwise ':', '/' and '@' fall back to 'history' = 10000).
vim.opt.shada = "!,'20,<50,s10,h,r/tmp/,:100,/100,@100"
-- Align indent to next multiple value of shiftwidth.
-- E.g., only insert as many spaces necessary for reaching the next shiftwidth
vim.opt.shiftround = true
-- Allow virtualedit (editing on empty spaces) in visual block mode (Ctrl+V)
vim.opt.virtualedit = "block"
-- True color support. Avoid if terminal does not support it.
vim.opt.termguicolors = true
vim.opt.signcolumn = "yes:2"
-- Diff options
vim.opt.diffopt:append({
"vertical",
"algorithm:histogram",
})
vim.opt.hlsearch = true
vim.opt.laststatus = 2
vim.opt.textwidth = 0
vim.opt.colorcolumn = "81"
vim.opt.shortmess:append("acC")
vim.opt.autoread = true
-- vim.opt.cmdheight = 0 -- To hide cmdline when not used. Disabled due to
-- causing "Press ENTER to continue" messages for small messages.
vim.opt.jumpoptions = { "stack", "view", "clean" }
vim.opt.updatetime = 100
vim.opt.guicursor:append("a:Cursor")
vim.opt.inccommand = "split"
vim.opt.winborder = "rounded"
vim.opt.confirm = true
require("git").setup()
vim.opt.statusline = "%{expand('%:.')} %{%v:lua.require('git').status()%} %3(%m%)"
.. " %="
.. " %{%v:lua.vim.diagnostic.status()%}"
.. " %{&filetype} %{&fileencoding} %{&fileformat}"
.. " %4(%p%%%) %4l:%-3v"
function _G.quickfix_text_func(info)
local items
if info.quickfix == 1 then
items = vim.fn.getqflist({ id = info.id, items = 1 }).items
else
items = vim.fn.getloclist(info.winid, { id = info.id, items = 1 }).items
end
local lines = {}
for i = info.start_idx, info.end_idx do
local item = items[i]
local line = ""
local name = ""
if item.bufnr ~= 0 then
name = vim.fn.fnamemodify(vim.fn.bufname(item.bufnr), ":.")
end
if name == "" then
name = " "
end
line = line .. name
if item.lnum > 0 then
line = line .. ":" .. item.lnum
if item.col > 0 then
line = line .. ":" .. item.col
end
line = line .. ": "
end
line = line
.. (item.text:gsub("^%s*(.-)%s*$", "%1"):gsub("%s*\n%s*", "\n "))
table.insert(lines, line)
end
return lines
end
vim.opt.quickfixtextfunc = "v:lua.quickfix_text_func"
vim.cmd([[
syntax on
filetype plugin indent on
]])