Files
dotfiles/.config/nvim/lua/config/options.lua
T
venomade 0bd1501855 Asahi
Soft reset of dotfiles specific to Asahi, Sway and Neovim.
2026-02-11 11:42:58 +00:00

108 lines
3.0 KiB
Lua

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 = "bash"
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 = 'single'
-- 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,
})