46 lines
1.3 KiB
Lua
46 lines
1.3 KiB
Lua
-- 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
|
|
]]
|