Skip to content

Commit 64ccd41

Browse files
authored
feat: add NeoTreeSignColumn highlight group (#275)
1 parent 63ddbd8 commit 64ccd41

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

doc/neo-tree.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ these yourself before the plugin loads, it will not be touched. If they do not
737737
exist, they will be created.
738738

739739
NeoTreeBufferNumber The buffer number shown in the buffers source.
740-
NeoTreeCursorLine |hi-CursorLine| override in Neo-tree window.
740+
NeoTreeCursorLine |hl-CursorLine| override in Neo-tree window.
741741
NeoTreeDimText Greyed out text used in various places.
742742
NeoTreeDirectoryIcon Directory icon.
743743
NeoTreeDirectoryName Directory name.
@@ -763,7 +763,8 @@ NeoTreeIndentMarker The style of indentation markers (guides). By default,
763763
the "Normal" highlight is used.
764764
NeoTreeExpander Used for collapsed/expanded icons.
765765
NeoTreeNormal |hl-Normal| override in Neo-tree window.
766-
NeoTreeNormalNC |hi-NormalNC| override in Neo-tree window.
766+
NeoTreeNormalNC |hl-NormalNC| override in Neo-tree window.
767+
NeoTreeSignColumn |hl-SignColumn| override in Neo-tree window.
767768
NeoTreeStatusLine |hl-StatusLine| override in Neo-tree window.
768769
NeoTreeStatusLineNC |hl-StatusLineNC| override in Neo-tree window.
769770
NeoTreeVertSplit |hl-VertSplit| override in Neo-tree window.

lua/neo-tree/setup/init.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ local define_events = function()
4949
return args
5050
end)
5151

52-
events.define_autocmd_event(events.VIM_BUFFER_CHANGED, { "BufWritePost", "BufFilePost", "BufModifiedSet" }, 200)
52+
events.define_autocmd_event(
53+
events.VIM_BUFFER_CHANGED,
54+
{ "BufWritePost", "BufFilePost", "BufModifiedSet" },
55+
200
56+
)
5357
events.define_autocmd_event(events.VIM_BUFFER_MODIFIED_SET, { "BufModifiedSet" }, 0)
5458
events.define_autocmd_event(events.VIM_BUFFER_ADDED, { "BufAdd" }, 200)
5559
events.define_autocmd_event(events.VIM_BUFFER_DELETED, { "BufDelete" }, 200)
@@ -69,7 +73,7 @@ M.buffer_enter_event = function()
6973
vim.cmd([[
7074
setlocal cursorline
7175
setlocal nowrap
72-
setlocal winhighlight=Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer
76+
setlocal winhighlight=Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,SignColumn:NeoTreeSignColumn,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer
7377
setlocal nolist nospell nonumber norelativenumber
7478
]])
7579
events.fire_event(events.NEO_TREE_BUFFER_ENTER)

lua/neo-tree/ui/highlights.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ M.INDENT_MARKER = "NeoTreeIndentMarker"
2929
M.MODIFIED = "NeoTreeModified"
3030
M.NORMAL = "NeoTreeNormal"
3131
M.NORMALNC = "NeoTreeNormalNC"
32+
M.SIGNCOLUMN = "NeoTreeSignColumn"
3233
M.STATUS_LINE = "NeoTreeStatusLine"
3334
M.STATUS_LINE_NC = "NeoTreeStatusLineNC"
3435
M.VERTSPLIT = "NeoTreeVertSplit"
@@ -104,7 +105,7 @@ local function create_highlight_group(hl_group_name, link_to_if_exists, backgrou
104105
end
105106

106107
local faded_highlight_group_cache = {}
107-
M.get_faded_highlight_group = function (hl_group_name, fade_percentage)
108+
M.get_faded_highlight_group = function(hl_group_name, fade_percentage)
108109
if type(hl_group_name) ~= "string" then
109110
error("hl_group_name must be a string")
110111
end
@@ -177,7 +178,12 @@ M.get_faded_highlight_group = function (hl_group_name, fade_percentage)
177178
local green = (f_green * fade_percentage) + (b_green * (1 - fade_percentage))
178179
local blue = (f_blue * fade_percentage) + (b_blue * (1 - fade_percentage))
179180

180-
local new_foreground = string.format("%s%s%s", dec_to_hex(red, 2), dec_to_hex(green, 2), dec_to_hex(blue, 2))
181+
local new_foreground = string.format(
182+
"%s%s%s",
183+
dec_to_hex(red, 2),
184+
dec_to_hex(green, 2),
185+
dec_to_hex(blue, 2)
186+
)
181187

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

197+
create_highlight_group(M.SIGNCOLUMN, { "SignColumn", M.NORMAL })
198+
191199
create_highlight_group(M.STATUS_LINE, { "StatusLine" })
192200
create_highlight_group(M.STATUS_LINE_NC, { "StatusLineNC" })
193201

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

241-
242249
return M

0 commit comments

Comments
 (0)