Skip to content
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

feat(#2415): add :NvimTreeHiTest #2664

Merged
merged 3 commits into from
Feb 11, 2024
Merged

feat(#2415): add :NvimTreeHiTest #2664

merged 3 commits into from
Feb 11, 2024

Conversation

alex-courtis
Copy link
Member

Minimum possible changes.

for _, g in ipairs(HIGHLIGHT_GROUPS) do
if g.link then
vim.api.nvim_command("hi def link " .. g.group .. " " .. g.link)
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order was preserved here: defined, legacy, links

Erring on the side of caution.

-- All highlight groups: linked or directly defined.
-- Please add new groups to help and preserve order.
-- Please avoid directly defined groups to preserve accessibility for TUI.
local HIGHLIGHT_GROUPS = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted to a list to preserve order.

@gegoune
Copy link
Collaborator

gegoune commented Feb 4, 2024

Interesting! How about placing it within debug or something like that freeing appearance to potential future apis that affect appearance?

@alex-courtis
Copy link
Member Author

Interesting! How about placing it within debug or something like that freeing appearance to potential future apis that affect appearance?

That is sensible. The code should also be moved; test/debug code should not pollute production code.

@alex-courtis
Copy link
Member Author

Git saw a delete rather than rename. Only trivial changes:

3,6c3,11
< -- All highlight groups: linked or directly defined.
< -- Please add new groups to help and preserve order.
< -- Please avoid directly defined groups to preserve accessibility for TUI.
< M.HIGHLIGHT_GROUPS = {
---
> -- directly defined groups, please keep these to an absolute minimum
> local DEFAULT_DEFS = {
> 
>   NvimTreeFolderIcon = "guifg=#8094b4 ctermfg=Blue",
>   NvimTreeWindowPicker = "guifg=#ededed guibg=#4493c8 gui=bold ctermfg=White ctermbg=Cyan",
> }
> 
> -- nvim-tree default highlight group links, please attempt to keep in order with help
> local DEFAULT_LINKS = {
9,21c14,26
<   { group = "NvimTreeNormal", link = "Normal" },
<   { group = "NvimTreeNormalFloat", link = "NormalFloat" },
<   { group = "NvimTreeNormalNC", link = "NvimTreeNormal" },
< 
<   { group = "NvimTreeLineNr", link = "LineNr" },
<   { group = "NvimTreeWinSeparator", link = "WinSeparator" },
<   { group = "NvimTreeEndOfBuffer", link = "EndOfBuffer" },
<   { group = "NvimTreePopup", link = "Normal" },
<   { group = "NvimTreeSignColumn", link = "NvimTreeNormal" },
< 
<   { group = "NvimTreeCursorColumn", link = "CursorColumn" },
<   { group = "NvimTreeCursorLine", link = "CursorLine" },
<   { group = "NvimTreeCursorLineNr", link = "CursorLineNr" },
---
>   NvimTreeNormal = "Normal",
>   NvimTreeNormalFloat = "NormalFloat",
>   NvimTreeNormalNC = "NvimTreeNormal",
> 
>   NvimTreeLineNr = "LineNr",
>   NvimTreeWinSeparator = "WinSeparator",
>   NvimTreeEndOfBuffer = "EndOfBuffer",
>   NvimTreePopup = "Normal",
>   NvimTreeSignColumn = "NvimTreeNormal",
> 
>   NvimTreeCursorColumn = "CursorColumn",
>   NvimTreeCursorLine = "CursorLine",
>   NvimTreeCursorLineNr = "CursorLineNr",
23,24c28,29
<   { group = "NvimTreeStatusLine", link = "StatusLine" },
<   { group = "NvimTreeStatusLineNC", link = "StatusLineNC" },
---
>   NvimTreeStatusLine = "StatusLine",
>   NvimTreeStatusLineNC = "StatusLineNC",
27,30c32,35
<   { group = "NvimTreeExecFile", link = "SpellCap" },
<   { group = "NvimTreeImageFile", link = "SpellCap" },
<   { group = "NvimTreeSpecialFile", link = "SpellCap" },
<   { group = "NvimTreeSymlink", link = "SpellCap" },
---
>   NvimTreeExecFile = "SpellCap",
>   NvimTreeImageFile = "SpellCap",
>   NvimTreeSpecialFile = "SpellCap",
>   NvimTreeSymlink = "SpellCap",
33,37c38,42
<   { group = "NvimTreeRootFolder", link = "Title" },
<   { group = "NvimTreeFolderName", link = "Directory" },
<   { group = "NvimTreeEmptyFolderName", link = "Directory" },
<   { group = "NvimTreeOpenedFolderName", link = "Directory" },
<   { group = "NvimTreeSymlinkFolderName", link = "Directory" },
---
>   NvimTreeRootFolder = "Title",
>   NvimTreeFolderName = "Directory",
>   NvimTreeEmptyFolderName = "Directory",
>   NvimTreeOpenedFolderName = "Directory",
>   NvimTreeSymlinkFolderName = "Directory",
40,41c45,46
<   { group = "NvimTreeFileIcon", link = "NvimTreeNormal" },
<   { group = "NvimTreeSymlinkIcon", link = "NvimTreeNormal" },
---
>   NvimTreeFileIcon = "NvimTreeNormal",
>   NvimTreeSymlinkIcon = "NvimTreeNormal",
44,48c49,52
<   { group = "NvimTreeFolderIcon", def = "guifg=#8094b4 ctermfg=Blue" },
<   { group = "NvimTreeOpenedFolderIcon", link = "NvimTreeFolderIcon" },
<   { group = "NvimTreeClosedFolderIcon", link = "NvimTreeFolderIcon" },
<   { group = "NvimTreeFolderArrowClosed", link = "NvimTreeIndentMarker" },
<   { group = "NvimTreeFolderArrowOpen", link = "NvimTreeIndentMarker" },
---
>   NvimTreeOpenedFolderIcon = "NvimTreeFolderIcon",
>   NvimTreeClosedFolderIcon = "NvimTreeFolderIcon",
>   NvimTreeFolderArrowClosed = "NvimTreeIndentMarker",
>   NvimTreeFolderArrowOpen = "NvimTreeIndentMarker",
51,54c55
<   { group = "NvimTreeIndentMarker", link = "NvimTreeFolderIcon" },
< 
<   -- Picker
<   { group = "NvimTreeWindowPicker", def = "guifg=#ededed guibg=#4493c8 gui=bold ctermfg=White ctermbg=Cyan" },
---
>   NvimTreeIndentMarker = "NvimTreeFolderIcon",
57,58c58,59
<   { group = "NvimTreeLiveFilterPrefix", link = "PreProc" },
<   { group = "NvimTreeLiveFilterValue", link = "ModeMsg" },
---
>   NvimTreeLiveFilterPrefix = "PreProc",
>   NvimTreeLiveFilterValue = "ModeMsg",
61,62c62,63
<   { group = "NvimTreeCutHL", link = "SpellBad" },
<   { group = "NvimTreeCopiedHL", link = "SpellRare" },
---
>   NvimTreeCutHL = "SpellBad",
>   NvimTreeCopiedHL = "SpellRare",
65,66c66,67
<   { group = "NvimTreeBookmarkIcon", link = "NvimTreeFolderIcon" },
<   { group = "NvimTreeBookmarkHL", link = "SpellLocal" },
---
>   NvimTreeBookmarkIcon = "NvimTreeFolderIcon",
>   NvimTreeBookmarkHL = "SpellLocal",
69,71c70,72
<   { group = "NvimTreeModifiedIcon", link = "Type" },
<   { group = "NvimTreeModifiedFileHL", link = "NvimTreeModifiedIcon" },
<   { group = "NvimTreeModifiedFolderHL", link = "NvimTreeModifiedFileHL" },
---
>   NvimTreeModifiedIcon = "Type",
>   NvimTreeModifiedFileHL = "NvimTreeModifiedIcon",
>   NvimTreeModifiedFolderHL = "NvimTreeModifiedFileHL",
74c75
<   { group = "NvimTreeOpenedHL", link = "Special" },
---
>   NvimTreeOpenedHL = "Special",
77,83c78,84
<   { group = "NvimTreeGitDeletedIcon", link = "Statement" },
<   { group = "NvimTreeGitDirtyIcon", link = "Statement" },
<   { group = "NvimTreeGitIgnoredIcon", link = "Comment" },
<   { group = "NvimTreeGitMergeIcon", link = "Constant" },
<   { group = "NvimTreeGitNewIcon", link = "PreProc" },
<   { group = "NvimTreeGitRenamedIcon", link = "PreProc" },
<   { group = "NvimTreeGitStagedIcon", link = "Constant" },
---
>   NvimTreeGitDeletedIcon = "Statement",
>   NvimTreeGitDirtyIcon = "Statement",
>   NvimTreeGitIgnoredIcon = "Comment",
>   NvimTreeGitMergeIcon = "Constant",
>   NvimTreeGitNewIcon = "PreProc",
>   NvimTreeGitRenamedIcon = "PreProc",
>   NvimTreeGitStagedIcon = "Constant",
86,92c87,93
<   { group = "NvimTreeGitFileDeletedHL", link = "NvimTreeGitDeletedIcon" },
<   { group = "NvimTreeGitFileDirtyHL", link = "NvimTreeGitDirtyIcon" },
<   { group = "NvimTreeGitFileIgnoredHL", link = "NvimTreeGitIgnoredIcon" },
<   { group = "NvimTreeGitFileMergeHL", link = "NvimTreeGitMergeIcon" },
<   { group = "NvimTreeGitFileNewHL", link = "NvimTreeGitNewIcon" },
<   { group = "NvimTreeGitFileRenamedHL", link = "NvimTreeGitRenamedIcon" },
<   { group = "NvimTreeGitFileStagedHL", link = "NvimTreeGitStagedIcon" },
---
>   NvimTreeGitFileDeletedHL = "NvimTreeGitDeletedIcon",
>   NvimTreeGitFileDirtyHL = "NvimTreeGitDirtyIcon",
>   NvimTreeGitFileIgnoredHL = "NvimTreeGitIgnoredIcon",
>   NvimTreeGitFileMergeHL = "NvimTreeGitMergeIcon",
>   NvimTreeGitFileNewHL = "NvimTreeGitNewIcon",
>   NvimTreeGitFileRenamedHL = "NvimTreeGitRenamedIcon",
>   NvimTreeGitFileStagedHL = "NvimTreeGitStagedIcon",
95,101c96,102
<   { group = "NvimTreeGitFolderDeletedHL", link = "NvimTreeGitFileDeletedHL" },
<   { group = "NvimTreeGitFolderDirtyHL", link = "NvimTreeGitFileDirtyHL" },
<   { group = "NvimTreeGitFolderIgnoredHL", link = "NvimTreeGitFileIgnoredHL" },
<   { group = "NvimTreeGitFolderMergeHL", link = "NvimTreeGitFileMergeHL" },
<   { group = "NvimTreeGitFolderNewHL", link = "NvimTreeGitFileNewHL" },
<   { group = "NvimTreeGitFolderRenamedHL", link = "NvimTreeGitFileRenamedHL" },
<   { group = "NvimTreeGitFolderStagedHL", link = "NvimTreeGitFileStagedHL" },
---
>   NvimTreeGitFolderDeletedHL = "NvimTreeGitFileDeletedHL",
>   NvimTreeGitFolderDirtyHL = "NvimTreeGitFileDirtyHL",
>   NvimTreeGitFolderIgnoredHL = "NvimTreeGitFileIgnoredHL",
>   NvimTreeGitFolderMergeHL = "NvimTreeGitFileMergeHL",
>   NvimTreeGitFolderNewHL = "NvimTreeGitFileNewHL",
>   NvimTreeGitFolderRenamedHL = "NvimTreeGitFileRenamedHL",
>   NvimTreeGitFolderStagedHL = "NvimTreeGitFileStagedHL",
104,107c105,108
<   { group = "NvimTreeDiagnosticErrorIcon", link = "DiagnosticError" },
<   { group = "NvimTreeDiagnosticWarnIcon", link = "DiagnosticWarn" },
<   { group = "NvimTreeDiagnosticInfoIcon", link = "DiagnosticInfo" },
<   { group = "NvimTreeDiagnosticHintIcon", link = "DiagnosticHint" },
---
>   NvimTreeDiagnosticErrorIcon = "DiagnosticError",
>   NvimTreeDiagnosticWarnIcon = "DiagnosticWarn",
>   NvimTreeDiagnosticInfoIcon = "DiagnosticInfo",
>   NvimTreeDiagnosticHintIcon = "DiagnosticHint",
110,113c111,114
<   { group = "NvimTreeDiagnosticErrorFileHL", link = "DiagnosticUnderlineError" },
<   { group = "NvimTreeDiagnosticWarnFileHL", link = "DiagnosticUnderlineWarn" },
<   { group = "NvimTreeDiagnosticInfoFileHL", link = "DiagnosticUnderlineInfo" },
<   { group = "NvimTreeDiagnosticHintFileHL", link = "DiagnosticUnderlineHint" },
---
>   NvimTreeDiagnosticErrorFileHL = "DiagnosticUnderlineError",
>   NvimTreeDiagnosticWarnFileHL = "DiagnosticUnderlineWarn",
>   NvimTreeDiagnosticInfoFileHL = "DiagnosticUnderlineInfo",
>   NvimTreeDiagnosticHintFileHL = "DiagnosticUnderlineHint",
116,119c117,120
<   { group = "NvimTreeDiagnosticErrorFolderHL", link = "NvimTreeDiagnosticErrorFileHL" },
<   { group = "NvimTreeDiagnosticWarnFolderHL", link = "NvimTreeDiagnosticWarnFileHL" },
<   { group = "NvimTreeDiagnosticInfoFolderHL", link = "NvimTreeDiagnosticInfoFileHL" },
<   { group = "NvimTreeDiagnosticHintFolderHL", link = "NvimTreeDiagnosticHintFileHL" },
---
>   NvimTreeDiagnosticErrorFolderHL = "NvimTreeDiagnosticErrorFileHL",
>   NvimTreeDiagnosticWarnFolderHL = "NvimTreeDiagnosticWarnFileHL",
>   NvimTreeDiagnosticInfoFolderHL = "NvimTreeDiagnosticInfoFileHL",
>   NvimTreeDiagnosticHintFolderHL = "NvimTreeDiagnosticHintFileHL",
123c124
< M.LEGACY_LINKS = {
---
> local LEGACY_LINKS = {
172,175c173,174
<   for _, g in ipairs(M.HIGHLIGHT_GROUPS) do
<     if g.def then
<       vim.api.nvim_command("hi def " .. g.group .. " " .. g.def)
<     end
---
>   for k, d in pairs(DEFAULT_DEFS) do
>     vim.api.nvim_command("hi def " .. k .. " " .. d)
179c178
<   for from, to in pairs(M.LEGACY_LINKS) do
---
>   for from, to in pairs(LEGACY_LINKS) do
195,198c194,195
<   for _, g in ipairs(M.HIGHLIGHT_GROUPS) do
<     if g.link then
<       vim.api.nvim_command("hi def link " .. g.group .. " " .. g.link)
<     end
---
>   for from, to in pairs(DEFAULT_LINKS) do
>     vim.api.nvim_command("hi def link " .. from .. " " .. to)

@alex-courtis alex-courtis merged commit b278fc2 into master Feb 11, 2024
4 checks passed
@alex-courtis alex-courtis deleted the 2415-hitest branch February 11, 2024 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants