1
0

chore(nvim): clean config

This commit is contained in:
2025-07-05 07:52:05 +02:00
parent 10caaf81c1
commit 4e43881829
8 changed files with 229 additions and 436 deletions

View File

@@ -1,64 +1,96 @@
-- Tabs for indenting
vim.opt.autoindent = true
vim.g.noexpandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
local opts = {
mapleader = ' ',
-- Line numbers
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.cursorlineopt = 'number'
linenr = {
number = true,
relativenumber = true,
cursorline = true,
cursorlineopt = 'number',
},
-- Use tabs for indents
indent = {
autoindent = true,
noexpandtab = true,
tabstop = 4,
shiftwidth = 4,
},
terminal = {
termguicolors = true,
shell = '/bin/fish',
},
split = {
splitright = true,
splitbelow = true,
},
search = {
hlsearch = false,
incsearch = true,
},
foldlevelstart = 99,
}
--- @param tbl table
local function apply(tbl)
for key, value in pairs(tbl) do
if type(value) == 'table' then
apply(value)
else
if vim.fn.exists('&' .. key) == 1 then
vim.opt[key] = value
else
vim.g[key] = value
end
end
end
end
apply(opts)
-- Tabs for indenting
-- vim.opt.autoindent = true
-- vim.g.noexpandtab = true
-- vim.opt.tabstop = 4
-- vim.opt.shiftwidth = 4
--
-- -- Line numbers
-- vim.opt.number = true
-- vim.opt.relativenumber = true
-- vim.opt.cursorline = true
-- vim.opt.cursorlineopt = 'number'
-- Folding
vim.opt.foldlevelstart = 99
-- vim.opt.foldlevelstart = 99
vim.g.mapleader = ' '
-- vim.g.mapleader = ' '
-- Terminal
vim.g.termguicolors = true
vim.opt.shell = '/bin/fish'
-- vim.g.termguicolors = true
-- vim.opt.shell = '/bin/fish'
-- LSP
vim.lsp.inlay_hint.enable()
-- vim.lsp.inlay_hint.enable()
-- Splitting
-- vim.cmd.set('splitbelow')
-- vim.cmd.set('splitright')
vim.opt.splitright = true
vim.opt.splitbelow = true
-- vim.opt.splitright = true
-- vim.opt.splitbelow = true
-- Make text readable
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { '*.md', '*.typ' },
command = 'setlocal linebreak',
})
-- vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
-- pattern = { '*.md', '*.typ' },
-- command = 'setlocal linebreak',
-- })
vim.api.nvim_create_autocmd('FileType', {
pattern = 'help',
command = 'setlocal linebreak',
})
vim.cmd.cnoreabbrev('grep', 'Grepper')
-- vim.api.nvim_create_autocmd('FileType', {
-- pattern = 'help',
-- command = 'setlocal linebreak',
-- })
-- Search
vim.opt.hlsearch = false
vim.opt.incsearch = true
-- Make dotfile navigation bareble
vim.api.nvim_create_user_command('Dot', 'edit ~/.config/nvim', {})
-- Git
vim.api.nvim_create_user_command('Glog', function()
local args = {
'log',
'--graph',
'--abbrev-commit',
'--decorate',
}
local str = ''
for _, arg in pairs(args) do
str = str .. ' ' .. arg
end
vim.cmd.Git(str)
end, {})
-- vim.opt.hlsearch = false
-- vim.opt.incsearch = true