Skip to content

Commit ecebdb4

Browse files
committed
Fix: Add viewer hooks and autocmds to hover popup for consistent highlighting
Problem: Currently, the hover popup only calls `helper.fern.renderer.highlight()` and `helper.fern.renderer.syntax()`, which means user customizations made through `FernHighlight`/`FernSyntax` autocmds or `viewer:highlight`/`viewer:syntax` hooks are not applied to the hover popups. As a result, fern-specific customizations made in these hooks/autocmds only affect the main window, creating visual inconsistency. This behavior makes it difficult to customize highlighting that is not defined by Fern, such as CursorLine, which is limited to fern. See also: #283 Solution: This PR adds `viewer:highlight`, `viewer:syntax` hooks and `FernHighlight`, `FernSyntax` autocmds to the hover popup's `s:apply()` function to ensure consistent highlighting between the main fern window and hover popups.
1 parent cb60188 commit ecebdb4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

autoload/fern/internal/drawer/hover_popup.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ function! s:show() abort
7373
function! s:apply() abort closure
7474
call setbufline('%', 1, line)
7575
call helper.fern.renderer.syntax()
76+
call fern#hook#emit('viewer:highlight', helper)
77+
doautocmd <nomodeline> User FernHighlight
7678
call helper.fern.renderer.highlight()
79+
call fern#hook#emit('viewer:syntax', helper)
80+
doautocmd <nomodeline> User FernSyntax
7781
syntax clear FernRootSymbol
7882
syntax clear FernRootText
7983

0 commit comments

Comments
 (0)