fix issue with diagnostics and gitsigns not rendering in the correct order
This commit is contained in:
parent
a1a1b05f99
commit
d5ccc1935d
@ -1,3 +1,5 @@
|
|||||||
|
" this file is managed by my personal theme management script.
|
||||||
|
|
||||||
set background=dark
|
set background=dark
|
||||||
colorscheme oxocarbon
|
colorscheme oxocarbon
|
||||||
hi MyNormalMode guibg=#33b1ff guifg=#161616
|
hi MyNormalMode guibg=#33b1ff guifg=#161616
|
||||||
@ -15,5 +17,11 @@ hi tabSepInactive2 guifg=#3c3836 guibg=#262626
|
|||||||
hi tabSepSpecial guifg=#FF7EB6 guibg=#262626
|
hi tabSepSpecial guifg=#FF7EB6 guibg=#262626
|
||||||
hi tabSepSpecial2 guifg=#262626 guibg=#262626
|
hi tabSepSpecial2 guifg=#262626 guibg=#262626
|
||||||
hi tabSepSpecial3 guifg=#262626 guibg=#262626
|
hi tabSepSpecial3 guifg=#262626 guibg=#262626
|
||||||
|
highlight GitSignsAdd guibg=#161616 guifg=#42be65
|
||||||
|
highlight GitSignsChange guibg=#161616 guifg=#33b1ff
|
||||||
|
highlight GitSignsDelete guibg=#161616 guifg=#ee5396
|
||||||
|
highlight GitSignsTopDelete guibg=#161616 guifg=#ee5396
|
||||||
|
highlight GitSignsChangeDelete guibg=#161616 guifg=#ee5396
|
||||||
|
highlight GitSignsUntracked guibg=#161616 guifg=#be95ff
|
||||||
luafile ~/.config/nvim/lua/core/statusline.lua
|
luafile ~/.config/nvim/lua/core/statusline.lua
|
||||||
luafile ~/.config/nvim/lua/core/tabline.lua
|
luafile ~/.config/nvim/lua/core/tabline.lua
|
||||||
|
@ -1,33 +1,31 @@
|
|||||||
function capitalize_head_exclusive(str)
|
function capitalize_head(str)
|
||||||
str = string.lower(str)
|
str = string.lower(str)
|
||||||
str = string.gsub(str, "^%l", string.upper)
|
str = string.gsub(str, "^%l", string.upper)
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
local signs = {
|
||||||
for type, icon in pairs(signs) do
|
[vim.diagnostic.severity.ERROR] = "E",
|
||||||
local hl = "DiagnosticSign" .. type
|
[vim.diagnostic.severity.WARN] = "W",
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
[vim.diagnostic.severity.HINT] = "H",
|
||||||
end
|
[vim.diagnostic.severity.INFO] = "I"
|
||||||
|
}
|
||||||
local max_width = math.min(math.floor(vim.o.columns * 0.7), 100)
|
|
||||||
local max_height = math.min(math.floor(vim.o.lines * 0.3), 30)
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
underline = true,
|
underline = true,
|
||||||
update_in_insert = true,
|
update_in_insert = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
virtual_text = false and {
|
virtual_text = false,
|
||||||
spacing = 1,
|
|
||||||
prefix = '', -- TODO: in nvim-0.10.0 this can be a function, so format won't be necessary
|
signs = {
|
||||||
format = function(d)
|
severity = { min = vim.diagnostic.severity.HINT },
|
||||||
local level = vim.diagnostic.severity[d.severity]
|
text = signs,
|
||||||
return string.format('%s %s', signs[capitalize_head_exclusive(level)], d.message)
|
priority = 4,
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
float = {
|
float = {
|
||||||
max_width = max_width,
|
max_width = math.min(math.floor(vim.o.columns * 0.7), 100),
|
||||||
max_height = max_height,
|
max_height = math.min(math.floor(vim.o.lines * 0.3), 30),
|
||||||
border = border_style,
|
border = border_style,
|
||||||
title = { { ' ', 'DiagnosticFloatTitleIcon' }, { 'Problems ', 'DiagnosticFloatTitle' } },
|
title = { { ' ', 'DiagnosticFloatTitleIcon' }, { 'Problems ', 'DiagnosticFloatTitle' } },
|
||||||
focusable = false,
|
focusable = false,
|
||||||
@ -35,11 +33,14 @@ vim.diagnostic.config({
|
|||||||
source = 'if_many',
|
source = 'if_many',
|
||||||
prefix = function(diag)
|
prefix = function(diag)
|
||||||
local level = vim.diagnostic.severity[diag.severity]
|
local level = vim.diagnostic.severity[diag.severity]
|
||||||
local prefix = string.format('%s ', signs[capitalize_head_exclusive(level)])
|
local prefix = string.format('%s ', signs[diag.severity])
|
||||||
return prefix, 'Diagnostic' .. level:gsub('^%l', string.upper)
|
return prefix, 'Diagnostic' .. level:gsub('^%l', string.upper)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd [[ autocmd! CursorHold * lua vim.diagnostic.open_float()]]
|
for severity, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. capitalize_head(vim.diagnostic.severity[severity])
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -1,49 +1,48 @@
|
|||||||
return {
|
return {
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
event = { 'BufEnter' },
|
event = { 'BufEnter' },
|
||||||
config = function()
|
config = function()
|
||||||
require('gitsigns').setup {
|
require('gitsigns').setup {
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = '█' },
|
add = { text = '▌' },
|
||||||
change = { text = '█' },
|
change = { text = '▌' },
|
||||||
delete = { text = '█' },
|
delete = { text = '▌' },
|
||||||
topdelete = { text = '█' },
|
topdelete = { text = '▌' },
|
||||||
changedelete = { text = '█' },
|
changedelete = { text = '▌' },
|
||||||
untracked = { text = '█' },
|
untracked = { text = '▌' },
|
||||||
},
|
},
|
||||||
signs_staged = {
|
signs_staged = {
|
||||||
add = { text = '█' },
|
add = { text = '▌' },
|
||||||
change = { text = '█' },
|
change = { text = '▌' },
|
||||||
delete = { text = '█' },
|
delete = { text = '▌' },
|
||||||
topdelete = { text = '█' },
|
topdelete = { text = '▌' },
|
||||||
changedelete = { text = '█' },
|
changedelete = { text = '▌' },
|
||||||
untracked = { text = '█' },
|
untracked = { text = '▌' },
|
||||||
},
|
},
|
||||||
signs_staged_enable = true,
|
signs_staged_enable = true,
|
||||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
signcolumn = true,
|
||||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
numhl = false,
|
||||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
linehl = false,
|
||||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
word_diff = false,
|
||||||
watch_gitdir = {
|
watch_gitdir = {
|
||||||
follow_files = true
|
follow_files = true
|
||||||
},
|
},
|
||||||
auto_attach = true,
|
auto_attach = true,
|
||||||
attach_to_untracked = false,
|
attach_to_untracked = false,
|
||||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
current_line_blame = false,
|
||||||
current_line_blame_opts = {
|
current_line_blame_opts = {
|
||||||
virt_text = true,
|
virt_text = true,
|
||||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
virt_text_pos = 'eol',
|
||||||
delay = 1000,
|
delay = 1000,
|
||||||
ignore_whitespace = false,
|
ignore_whitespace = false,
|
||||||
virt_text_priority = 100,
|
virt_text_priority = 100,
|
||||||
},
|
},
|
||||||
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
|
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
|
||||||
sign_priority = 6,
|
sign_priority = 10,
|
||||||
update_debounce = 100,
|
update_debounce = 100,
|
||||||
status_formatter = nil, -- Use default
|
status_formatter = nil,
|
||||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
max_file_length = 40000,
|
||||||
preview_config = {
|
preview_config = {
|
||||||
-- Options passed to nvim_open_win
|
|
||||||
border = 'single',
|
border = 'single',
|
||||||
style = 'minimal',
|
style = 'minimal',
|
||||||
relative = 'cursor',
|
relative = 'cursor',
|
||||||
|
Loading…
Reference in New Issue
Block a user