Skip to content

Instantly share code, notes, and snippets.

@tyru
Last active November 26, 2018 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyru/6a72ce65587bfa188c9dcb78acabf333 to your computer and use it in GitHub Desktop.
Save tyru/6a72ce65587bfa188c9dcb78acabf333 to your computer and use it in GitHub Desktop.
set laststatus=2
let &statusline = '%!StatusLine()'
function! StatusLine() abort
if &hlsearch
" XXX: 'l', 'h' do not move current cursor!
let searchcount = matchstr(execute('keepjumps keepmarks %s//&/gne', 'silent'), '\d\+')
let searchcount = printf(' (%s/%s)', searchcount !=# '' ? searchcount : '0', @/)
else
let searchcount = ''
endif
return '%f%( [%M%R%H%W]%)%( [%{&ft}]%) %{&fenc}/%{&ff}'
\ . '%('
\ . '%( %{line(".")}/%{line("$")}%)'
\ . '%)'
\ . searchcount
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment