This commit is contained in:
Walter Jenkins 2025-04-16 08:39:09 -05:00
parent 5bdde24dfb
commit dd1d1bb6e9
49 changed files with 2444 additions and 1322 deletions

45
lua/core/snippets.lua Normal file
View file

@ -0,0 +1,45 @@
-- Custom code snippets for different purposes
-- Prevent LSP from overwriting treesitter color settings
-- https://github.com/NvChad/NvChad/issues/1907
vim.highlight.priorities.semantic_tokens = 95 -- Or any number lower than 100, treesitter's priority level
-- Appearance of diagnostics
vim.diagnostic.config {
virtual_text = {
prefix = '',
-- Add a custom format function to show error codes
format = function(diagnostic)
local code = diagnostic.code and string.format('[%s]', diagnostic.code) or ''
return string.format('%s %s', code, diagnostic.message)
end,
},
underline = false,
update_in_insert = true,
float = {
source = 'always', -- Or "if_many"
},
-- Make diagnostic background transparent
on_ready = function()
vim.cmd 'highlight DiagnosticVirtualText guibg=NONE'
end,
}
-- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
-- Set kitty terminal padding to 0 when in nvim
vim.cmd [[
augroup kitty_mp
autocmd!
au VimLeave * :silent !kitty @ set-spacing padding=default margin=default
au VimEnter * :silent !kitty @ set-spacing padding=0 margin=0 3 0 3
augroup END
]]