Files
dotfiles/.config/nvim/lua/core/options.lua
T

91 lines
2.2 KiB
Lua

-- ============================================================================
-- Neovim Options - Grundlegende Einstellungen
-- ============================================================================
local opt = vim.opt
-- Zeilennummern
opt.number = true
opt.relativenumber = false -- Absolute Nummern für QA-Arbeit
-- Maus
opt.mouse = 'a'
-- Clipboard (System Clipboard nutzen)
opt.clipboard = 'unnamedplus'
-- Tabs & Indentation
opt.tabstop = 2
opt.shiftwidth = 2
opt.expandtab = true
opt.autoindent = true
opt.breakindent = true
-- Suche
opt.ignorecase = true
opt.smartcase = true
opt.hlsearch = true
opt.incsearch = true
opt.inccommand = 'split'
-- Aussehen
opt.termguicolors = true
opt.signcolumn = 'yes'
opt.cursorline = true
opt.scrolloff = 10
opt.sidescrolloff = 8
-- Split windows
opt.splitright = true
opt.splitbelow = true
-- Undo & Backup
opt.undofile = true
opt.backup = false
opt.swapfile = false
-- Performance
opt.updatetime = 250
opt.timeoutlen = 300
-- Whitespace characters
opt.list = true
opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
-- Command line
opt.showmode = false -- Statusline zeigt mode schon
-- Completion
opt.completeopt = 'menu,menuone,noselect'
-- Fold (erstmal aus)
opt.foldenable = false
-- ============================================================================
-- NEU: Automatischer Wechsel für QA vs. Speed (Hybrid Line Numbers)
-- ============================================================================
-- Normal Mode = Relative Nummern (zum schnellen Springen)
-- Insert Mode = Absolute Nummern (zum Ablesen für Tickets/Kollegen)
local augroup = vim.api.nvim_create_augroup("numbertoggle", {})
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "CmdlineLeave" }, {
group = augroup,
pattern = "*",
callback = function()
if vim.o.nu and vim.api.nvim_get_mode().mode ~= "i" then
vim.opt.relativenumber = true
end
end,
})
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter" }, {
group = augroup,
pattern = "*",
callback = function()
if vim.o.nu then
vim.opt.relativenumber = false
vim.cmd "redraw"
end
end,
})