Skip to content

feat: add highlight group #235

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 2 commits into from
Apr 3, 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
3 changes: 3 additions & 0 deletions doc/neo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ NeoTreeIndentMarker The style of indentation markers (guides). By default,
NeoTreeExpander Used for collapsed/expanded icons.
NeoTreeNormal |hl-Normal| override in Neo-tree window.
NeoTreeNormalNC |hi-NormalNC| 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.
NeoTreeRootName The name of the root node.
NeoTreeSymbolicLinkTarget Symbolic link target.
NeoTreeTitleBar Used for the title bar of pop-ups, when the border-style
Expand Down
5 changes: 2 additions & 3 deletions lua/neo-tree/setup/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local log = require("neo-tree.log")
local file_nesting = require("neo-tree.sources.common.file-nesting")
local highlights = require("neo-tree.ui.highlights")
local manager = require("neo-tree.sources.manager")
local netrw = require("neo-tree.setup.netrw")
local netrw = require("neo-tree.setup.netrw")

-- If you add a new source, you need to add it to the sources table.
-- Each source should have a defaults module that contains the default values
Expand Down Expand Up @@ -68,7 +68,7 @@ M.buffer_enter_event = function()
vim.cmd([[
setlocal cursorline
setlocal nowrap
setlocal winhighlight=Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder
setlocal winhighlight=Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit
setlocal nolist nospell nonumber norelativenumber
]])
events.fire_event(events.NEO_TREE_BUFFER_ENTER)
Expand All @@ -93,7 +93,6 @@ M.buffer_enter_event = function()
end
last_buffer_enter_filetype = vim.bo.filetype


-- there is nothing more we want to do with floating windows
if utils.is_floating() then
return
Expand Down
8 changes: 8 additions & 0 deletions lua/neo-tree/ui/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ M.HIDDEN_BY_NAME = "NeoTreeHiddenByName"
M.INDENT_MARKER = "NeoTreeIndentMarker"
M.NORMAL = "NeoTreeNormal"
M.NORMALNC = "NeoTreeNormalNC"
M.STATUS_LINE = "NeoTreeStatusLine"
M.STATUS_LINE_NC = "NeoTreeStatusLineNC"
M.VERTSPLIT = "NeoTreeVertSplit"
M.ROOT_NAME = "NeoTreeRootName"
M.SYMBOLIC_LINK_TARGET = "NeoTreeSymbolicLinkTarget"
M.TITLE_BAR = "NeoTreeTitleBar"
Expand Down Expand Up @@ -97,6 +100,11 @@ 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.STATUS_LINE, { "StatusLine" })
create_highlight_group(M.STATUS_LINE_NC, { "StatusLineNC" })

create_highlight_group(M.VERTSPLIT, { "VertSplit" })

local float_border_hl = create_highlight_group(
M.FLOAT_BORDER,
{ "FloatBorder" },
Expand Down