Customizable statusline

Close #32
This commit is contained in:
Junegunn Choi
2015-10-31 00:33:06 +09:00
parent df65943036
commit 0e995e1913
2 changed files with 31 additions and 11 deletions

View File

@@ -173,6 +173,21 @@ inoremap <expr> <c-x><c-s> fzf#complete({
\ 'left': 20}) \ 'left': 20})
``` ```
Status line (neovim)
--------------------
```vim
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline()
```
License License
------- -------

View File

@@ -79,14 +79,19 @@ endfunction
if has('nvim') && get(g:, 'fzf_nvim_statusline', 1) if has('nvim') && get(g:, 'fzf_nvim_statusline', 1)
function! s:fzf_restore_colors() function! s:fzf_restore_colors()
if $TERM !~ "256color" if exists('#User#FzfStatusLine')
highlight fzf1 ctermfg=1 ctermbg=8 doautocmd User FzfStatusLine
highlight fzf2 ctermfg=2 ctermbg=8
highlight fzf3 ctermfg=7 ctermbg=8
else else
highlight fzf1 ctermfg=161 ctermbg=238 if $TERM !~ "256color"
highlight fzf2 ctermfg=151 ctermbg=238 highlight fzf1 ctermfg=1 ctermbg=8
highlight fzf3 ctermfg=252 ctermbg=238 highlight fzf2 ctermfg=2 ctermbg=8
highlight fzf3 ctermfg=7 ctermbg=8
else
highlight fzf1 ctermfg=161 ctermbg=238
highlight fzf2 ctermfg=151 ctermbg=238
highlight fzf3 ctermfg=252 ctermbg=238
endif
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endif endif
endfunction endfunction
@@ -96,13 +101,13 @@ if has('nvim') && get(g:, 'fzf_nvim_statusline', 1)
endif endif
setlocal nospell setlocal nospell
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f call s:fzf_restore_colors()
endfunction endfunction
augroup fzf_statusline augroup _fzf_statusline
autocmd! autocmd!
autocmd TermOpen *bin/fzf* call s:fzf_nvim_term() | autocmd WinEnter <buffer> call s:fzf_nvim_term() autocmd FileType fzf call s:fzf_nvim_term()
autocmd VimEnter,ColorScheme * call s:fzf_restore_colors() \| autocmd WinEnter,ColorScheme <buffer> call s:fzf_restore_colors()
augroup END augroup END
endif endif