diff options
| author | venomade <venomade@venomade.com> | 2026-01-18 16:07:54 +0000 |
|---|---|---|
| committer | venomade <venomade@venomade.com> | 2026-01-18 16:07:54 +0000 |
| commit | 8d688d1107c46b6dfdcaf02fa5c9c4c8a4640e65 (patch) | |
| tree | 76edfeb78094eb8491b1f32a2acd45b6ba95ffa2 /.config/nvim/lua/config/options.lua | |
| parent | edcf5dd381c26274a939f4e703539b15c0058e99 (diff) | |
KDE & Emacs
Diffstat (limited to '.config/nvim/lua/config/options.lua')
| -rw-r--r-- | .config/nvim/lua/config/options.lua | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua new file mode 100644 index 0000000..fd1de92 --- /dev/null +++ b/.config/nvim/lua/config/options.lua @@ -0,0 +1,110 @@ +vim.opt.nu = true +vim.opt.rnu = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.autoindent = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 12 + +vim.opt.updatetime = 50 + +vim.opt.splitbelow = true +vim.opt.splitright = true + +vim.opt.encoding = "utf-8" + +vim.opt.shell = "zsh" + +vim.opt.mouse = "a" + +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.incsearch = true + +-- vim.opt.cursorline = true + +vim.opt.title = true + +vim.opt.clipboard = "unnamedplus" + +vim.opt.colorcolumn = "80" + +vim.opt.signcolumn = 'no' + +vim.cmd "set showtabline=0 | set laststatus=0" + +vim.wo.fillchars='eob: ' + +vim.opt.conceallevel = 3 + +-- Window Borders +vim.o.winborder = 'rounded' + +-- Remove Whitespaces on File Save +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[%s/\s\+$//e]], +}) + +-- Define highlight groups for line numbers with diagnostics +vim.api.nvim_set_hl(0, "LineNrDiagnosticError", { bg = "#3f1d1d", fg = "#ff6c6b" }) +vim.api.nvim_set_hl(0, "LineNrDiagnosticWarn", { bg = "#3f311d", fg = "#ECBE7B" }) +vim.api.nvim_set_hl(0, "LineNrDiagnosticInfo", { bg = "#1d2d3f", fg = "#51afef" }) +vim.api.nvim_set_hl(0, "LineNrDiagnosticHint", { bg = "#1d3f2d", fg = "#98be65" }) + +local function set_line_number_highlight() + -- Clear existing highlights + vim.fn.sign_unplace("LineNrDiagnostics") + + -- Get diagnostics per buffer + for _, diag in ipairs(vim.diagnostic.get(0)) do + local hl_group = nil + if diag.severity == vim.diagnostic.severity.ERROR then + hl_group = "LineNrDiagnosticError" + elseif diag.severity == vim.diagnostic.severity.WARN then + hl_group = "LineNrDiagnosticWarn" + elseif diag.severity == vim.diagnostic.severity.INFO then + hl_group = "LineNrDiagnosticInfo" + elseif diag.severity == vim.diagnostic.severity.HINT then + hl_group = "LineNrDiagnosticHint" + end + + if hl_group then + vim.fn.sign_place(0, "LineNrDiagnostics", hl_group, vim.api.nvim_get_current_buf(), { + lnum = diag.lnum + 1, -- diagnostics are 0-indexed + priority = 10, + }) + end + end +end + +-- Create the sign definitions +vim.fn.sign_define("LineNrDiagnosticError", { text = "", texthl = "LineNrDiagnosticError", numhl = "LineNrDiagnosticError" }) +vim.fn.sign_define("LineNrDiagnosticWarn", { text = "", texthl = "LineNrDiagnosticWarn", numhl = "LineNrDiagnosticWarn" }) +vim.fn.sign_define("LineNrDiagnosticInfo", { text = "", texthl = "LineNrDiagnosticInfo", numhl = "LineNrDiagnosticInfo" }) +vim.fn.sign_define("LineNrDiagnosticHint", { text = "", texthl = "LineNrDiagnosticHint", numhl = "LineNrDiagnosticHint" }) + +-- Update line numbers when diagnostics change +vim.api.nvim_create_autocmd({ "DiagnosticChanged", "BufEnter", "CursorHold" }, { + callback = set_line_number_highlight, +}) + +-- TODO: Put somewhere else (for llm.nvim) +vim.fn.setenv("LLM_KEY", "NONE") |
