kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.16k stars 37 forks source link

Allow custom highlight of line number for folded text #168

Open ReubenM opened 9 months ago

ReubenM commented 9 months ago

Feature description

Title should be self explanatory.

Describe the solution you'd like

Something more elaborate might be more fitting, but for a quick hack:

diff --git a/lua/ufo/highlight.lua b/lua/ufo/highlight.lua
index 3f8dfc8..3f1baf4 100644
--- a/lua/ufo/highlight.lua
+++ b/lua/ufo/highlight.lua
@@ -60,6 +60,7 @@ local function resetHighlightGroup()
         hi default link UfoPreviewCursorLine Visual
         hi default link UfoFoldedEllipsis Comment
         hi default link UfoCursorFoldedLine CursorLine
+        hi default link UfoFoldedLineNr LineNr
     ]])
 end

diff --git a/lua/ufo/model/foldedline.lua b/lua/ufo/model/foldedline.lua
index 1cfdae1..bca690d 100644
--- a/lua/ufo/model/foldedline.lua
+++ b/lua/ufo/model/foldedline.lua
@@ -50,7 +50,8 @@ function FoldedLine:updateVirtText(lnum, endLnum, virtText)
         virt_text = virtText,
         virt_text_win_col = 0,
         priority = 10,
-        hl_mode = 'combine'
+        hl_mode = 'combine',
+        number_hl_group = 'UfoFoldedLineNr'
     })
     self.virtText = virtText
 end

Additional context

No response