Skip to content

Commit a4b88f1

Browse files
hbielcseickel
andauthored
feat(ui): add NeoTreeFloatTitle highlight group (#169)
Co-authored-by: Chris Seickel <cseickel@gmail.com>
1 parent 2044cf3 commit a4b88f1

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

doc/neo-tree.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,18 @@ NeoTreeFileNameOpened File name when the file is open. Not used yet.
492492
NeoTreeSymbolicLinkTarget Symbolic link target.
493493
NeoTreeFilterTerm The filter term, as displayed in the root node.
494494
NeoTreeFloatBorder The border for pop-up windows.
495+
NeoTreeFloatTitle Used for the title text of pop-ups when the border-style
496+
is set to another style than "NC". This is derived
497+
from NeoTreeFloatBorder.
498+
NeoTreeTitleBar Used for the title bar of pop-ups, when the border-style
499+
is set to "NC". This is derived from NeoTreeFloatBorder.
495500
NeoTreeGitAdded File name when the git status is added.
496501
NeoTreeGitConflict File name when the git status is conflict.
497502
NeoTreeGitModified File name when the git status is modified.
498503
NeoTreeGitUntracked File name when the git status is untracked.
499504
NeoTreeNormal |hl-Normal| override in Neo-tree window.
500505
NeoTreeNormalNC |hi-NormalNC| override in Neo-tree window.
501506
NeoTreeRootName The name of the root node.
502-
NeoTreeTitleBar Used for the title bar of pop-ups, when the border-style
503-
is set to "NC". This is derived from NeoTreeFloatBorder.
504507
NeoTreeIndentMarker The style of indentation markers (guides). By default,
505508
the "Normal" highlight is used.
506509

lua/neo-tree/ui/highlights.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ M.FILE_NAME_OPENED = "NeoTreeFileNameOpened"
1212
M.SYMBOLIC_LINK_TARGET = "NeoTreeSymbolicLinkTarget"
1313
M.FILTER_TERM = "NeoTreeFilterTerm"
1414
M.FLOAT_BORDER = "NeoTreeFloatBorder"
15+
M.FLOAT_TITLE = "NeoTreeFloatTitle"
1516
M.GIT_ADDED = "NeoTreeGitAdded"
1617
M.GIT_CONFLICT = "NeoTreeGitConflict"
1718
M.GIT_MODIFIED = "NeoTreeGitModified"
@@ -94,6 +95,7 @@ M.setup = function()
9495
"444444"
9596
)
9697

98+
create_highlight_group(M.FLOAT_TITLE, {}, float_border_hl.background, normal_hl.foreground)
9799
create_highlight_group(M.TITLE_BAR, {}, float_border_hl.foreground, nil)
98100

99101
create_highlight_group(M.GIT_ADDED, { "GitGutterAdd", "GitSignsAdd" }, nil, "5faf5f")

lua/neo-tree/ui/popups.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ M.popup_options = function(title, min_width, override_options)
1818

1919
local nt = require("neo-tree")
2020
local popup_border_style = nt.config.popup_border_style
21+
local popup_border_text = NuiText(" " .. title .. " ", highlights.FLOAT_TITLE)
2122
local popup_options = {
2223
relative = "cursor",
2324
position = {
@@ -27,7 +28,7 @@ M.popup_options = function(title, min_width, override_options)
2728
size = width,
2829
border = {
2930
text = {
30-
top = title,
31+
top = popup_border_text
3132
},
3233
style = popup_border_style,
3334
highlight = highlights.FLOAT_BORDER,
@@ -44,12 +45,12 @@ M.popup_options = function(title, min_width, override_options)
4445

4546
if popup_border_style == "NC" then
4647
local blank = NuiText(" ", highlights.TITLE_BAR)
47-
local text = NuiText(" " .. title .. " ", highlights.TITLE_BAR)
48+
popup_border_text = NuiText(" " .. title .. " ", highlights.TITLE_BAR)
4849
popup_options.border = {
4950
style = { "", blank, "", "", " ", "", " ", "" },
5051
highlight = highlights.FLOAT_BORDER,
5152
text = {
52-
top = text,
53+
top = popup_border_text,
5354
top_align = "left",
5455
},
5556
}

0 commit comments

Comments
 (0)