Skip to content

fix: missing signcolumn highlight group #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/neo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ these yourself before the plugin loads, it will not be touched. If they do not
exist, they will be created.

NeoTreeBufferNumber The buffer number shown in the buffers source.
NeoTreeCursorLine |hi-CursorLine| override in Neo-tree window.
NeoTreeCursorLine |hl-CursorLine| override in Neo-tree window.
NeoTreeDimText Greyed out text used in various places.
NeoTreeDirectoryIcon Directory icon.
NeoTreeDirectoryName Directory name.
Expand All @@ -757,7 +757,8 @@ NeoTreeIndentMarker The style of indentation markers (guides). By default,
the "Normal" highlight is used.
NeoTreeExpander Used for collapsed/expanded icons.
NeoTreeNormal |hl-Normal| override in Neo-tree window.
NeoTreeNormalNC |hi-NormalNC| override in Neo-tree window.
NeoTreeNormalNC |hl-NormalNC| override in Neo-tree window.
NeoTreeSignColumn |hl-SignColumn| override in Neo-tree window.
NeoTreeStatusLine |hl-StatusLine| override in Neo-tree window.
NeoTreeStatusLineNC |hl-StatusLineNC| override in Neo-tree window.
NeoTreeVertSplit |hl-VertSplit| override in Neo-tree window.
Expand Down
8 changes: 6 additions & 2 deletions lua/neo-tree/setup/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ local define_events = function()
return args
end)

events.define_autocmd_event(events.VIM_BUFFER_CHANGED, { "BufWritePost", "BufFilePost", "BufModifiedSet" }, 200)
events.define_autocmd_event(
events.VIM_BUFFER_CHANGED,
{ "BufWritePost", "BufFilePost", "BufModifiedSet" },
200
)
events.define_autocmd_event(events.VIM_BUFFER_MODIFIED_SET, { "BufModifiedSet" }, 0)
events.define_autocmd_event(events.VIM_BUFFER_ADDED, { "BufAdd" }, 200)
events.define_autocmd_event(events.VIM_BUFFER_DELETED, { "BufDelete" }, 200)
Expand All @@ -69,7 +73,7 @@ M.buffer_enter_event = function()
vim.cmd([[
setlocal cursorline
setlocal nowrap
setlocal winhighlight=Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer
setlocal winhighlight=Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,SignColumn:NeoTreeSignColumn,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer
setlocal nolist nospell nonumber norelativenumber
]])
events.fire_event(events.NEO_TREE_BUFFER_ENTER)
Expand Down
13 changes: 10 additions & 3 deletions lua/neo-tree/ui/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ M.INDENT_MARKER = "NeoTreeIndentMarker"
M.MODIFIED = "NeoTreeModified"
M.NORMAL = "NeoTreeNormal"
M.NORMALNC = "NeoTreeNormalNC"
M.SIGNCOLUMN = "NeoTreeSignColumn"
M.STATUS_LINE = "NeoTreeStatusLine"
M.STATUS_LINE_NC = "NeoTreeStatusLineNC"
M.VERTSPLIT = "NeoTreeVertSplit"
Expand Down Expand Up @@ -104,7 +105,7 @@ local function create_highlight_group(hl_group_name, link_to_if_exists, backgrou
end

local faded_highlight_group_cache = {}
M.get_faded_highlight_group = function (hl_group_name, fade_percentage)
M.get_faded_highlight_group = function(hl_group_name, fade_percentage)
if type(hl_group_name) ~= "string" then
error("hl_group_name must be a string")
end
Expand Down Expand Up @@ -177,7 +178,12 @@ M.get_faded_highlight_group = function (hl_group_name, fade_percentage)
local green = (f_green * fade_percentage) + (b_green * (1 - fade_percentage))
local blue = (f_blue * fade_percentage) + (b_blue * (1 - fade_percentage))

local new_foreground = string.format("%s%s%s", dec_to_hex(red, 2), dec_to_hex(green, 2), dec_to_hex(blue, 2))
local new_foreground = string.format(
"%s%s%s",
dec_to_hex(red, 2),
dec_to_hex(green, 2),
dec_to_hex(blue, 2)
)

create_highlight_group(key, {}, hl_group.background, new_foreground, gui)
faded_highlight_group_cache[key] = key
Expand All @@ -188,6 +194,8 @@ M.setup = function()
local normal_hl = create_highlight_group(M.NORMAL, { "Normal" })
local normalnc_hl = create_highlight_group(M.NORMALNC, { "NormalNC", M.NORMAL })

create_highlight_group(M.SIGNCOLUMN, { "SignColumn", M.NORMAL })

create_highlight_group(M.STATUS_LINE, { "StatusLine" })
create_highlight_group(M.STATUS_LINE_NC, { "StatusLineNC" })

Expand Down Expand Up @@ -238,5 +246,4 @@ M.setup = function()
create_highlight_group(M.GIT_UNTRACKED, {}, nil, conflict.foreground, "italic")
end


return M