Skip to content

Commit 774e283

Browse files
authored
Merge pull request #131 from lambdalisue/select-statusline
Support custom highlight in window select
2 parents 40b8fc9 + 1f7bbf7 commit 774e283

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

autoload/fern/internal/window.vim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function! s:statusline(winnr, char) abort
8282
let width = winwidth(a:winnr) - len(a:winnr . '') - 6
8383
let leading = repeat(' ', width / 2)
8484
return printf(
85-
\ '%%#NonText#%s%%#DiffText# %s %%#NonText#',
85+
\ '%%#FernWindowSelectStatusLine#%s%%#FernWindowSelectIndicator# %s %%#FernWindowSelectStatusLine#',
8686
\ leading,
8787
\ a:char,
8888
\)
@@ -105,7 +105,19 @@ function! s:cunmap_all() abort
105105
endfor
106106
endfunction
107107

108+
function! s:highlight() abort
109+
highlight default link FernWindowSelectStatusLine StatusLineNC
110+
highlight default link FernWindowSelectIndicator DiffText
111+
endfunction
112+
108113
call s:Config.config(expand('<sfile>:p'), {
109114
\ 'auto_select': 1,
110115
\ 'select_chars': split('abcdefghijklmnopqrstuvwxyz', '\zs'),
111116
\})
117+
118+
augroup fern_internal_window_internal
119+
autocmd!
120+
autocmd ColorScheme * call s:highlight()
121+
augroup END
122+
123+
call s:highlight()

doc/fern.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Window selector~
6565
Fern has an internal window selector which works like
6666
t9md/vim-choosewin. Users can quickly select which window to open a
6767
selected node.
68+
See |hl-FernWindowSelectIndicator| and |hl-FernWindowSelectStatusLine|
69+
to customize the statusline when selecting a window.
6870
https://github.com/t9md/vim-choosewin
6971

7072
Renamer (A.k.a exrename)~
@@ -615,11 +617,19 @@ FernBranchSymbol *hl-FernBranchSymbol*
615617
An actual appearance will be determined by the |fern-renderer| thus
616618
this highlight might not be referred.
617619

618-
FernBranchText *hl-FernBranchText*
620+
FernBranchText *hl-FernBranchText*
619621
A |highlight| group of renderer used for branch node text.
620622
An actual appearance will be determined by the |fern-renderer| thus
621623
this highlight might not be referred.
622624

625+
FernWindowSelectIndicator *hl-FernWindowSelectIndicator*
626+
A |highlight| group used for an indicator when selecting a window
627+
through "open:select" action.
628+
629+
FernWindowSelectStatusLine *hl-FernWindowSelectStatusLine*
630+
A |highlight| group used for |statusline| when selecting a window
631+
through "open:select" action.
632+
623633

624634
=============================================================================
625635
CHANGELOG *fern-changelog*

0 commit comments

Comments
 (0)