From 1f7bbf7fbe8c52b79c8d6da96f20e14c29a78260 Mon Sep 17 00:00:00 2001 From: lambdalisue Date: Sun, 2 Aug 2020 19:20:25 +0900 Subject: [PATCH] Support custom highlight in window select --- autoload/fern/internal/window.vim | 14 +++++++++++++- doc/fern.txt | 12 +++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/autoload/fern/internal/window.vim b/autoload/fern/internal/window.vim index 1dc13dce..ca136e87 100644 --- a/autoload/fern/internal/window.vim +++ b/autoload/fern/internal/window.vim @@ -82,7 +82,7 @@ function! s:statusline(winnr, char) abort let width = winwidth(a:winnr) - len(a:winnr . '') - 6 let leading = repeat(' ', width / 2) return printf( - \ '%%#NonText#%s%%#DiffText# %s %%#NonText#', + \ '%%#FernWindowSelectStatusLine#%s%%#FernWindowSelectIndicator# %s %%#FernWindowSelectStatusLine#', \ leading, \ a:char, \) @@ -105,7 +105,19 @@ function! s:cunmap_all() abort endfor endfunction +function! s:highlight() abort + highlight default link FernWindowSelectStatusLine StatusLineNC + highlight default link FernWindowSelectIndicator DiffText +endfunction + call s:Config.config(expand(':p'), { \ 'auto_select': 1, \ 'select_chars': split('abcdefghijklmnopqrstuvwxyz', '\zs'), \}) + +augroup fern_internal_window_internal + autocmd! + autocmd ColorScheme * call s:highlight() +augroup END + +call s:highlight() diff --git a/doc/fern.txt b/doc/fern.txt index 83b796f6..ccb31cd5 100644 --- a/doc/fern.txt +++ b/doc/fern.txt @@ -65,6 +65,8 @@ Window selector~ Fern has an internal window selector which works like t9md/vim-choosewin. Users can quickly select which window to open a selected node. + See |hl-FernWindowSelectIndicator| and |hl-FernWindowSelectStatusLine| + to customize the statusline when selecting a window. https://github.com/t9md/vim-choosewin Renamer (A.k.a exrename)~ @@ -615,11 +617,19 @@ FernBranchSymbol *hl-FernBranchSymbol* An actual appearance will be determined by the |fern-renderer| thus this highlight might not be referred. -FernBranchText *hl-FernBranchText* +FernBranchText *hl-FernBranchText* A |highlight| group of renderer used for branch node text. An actual appearance will be determined by the |fern-renderer| thus this highlight might not be referred. +FernWindowSelectIndicator *hl-FernWindowSelectIndicator* + A |highlight| group used for an indicator when selecting a window + through "open:select" action. + +FernWindowSelectStatusLine *hl-FernWindowSelectStatusLine* + A |highlight| group used for |statusline| when selecting a window + through "open:select" action. + ============================================================================= CHANGELOG *fern-changelog*