bairui

CharCount in Statusline

Jul 4th, 2011
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.35 KB | None | 0 0
  1. function! CharCount()
  2.   redir => l:gcount
  3.   silent exe "normal! g\<c-g>"
  4.   redir END
  5.   let l:type = matchstr(l:gcount, '\(Char\|Byte\)')
  6.   return substitute(l:gcount, '.*' . l:type . '\s*\(\d\+\)\s*of\s*\(\d\+\).*', 'Char \1 of \2', '')
  7. endfunction
  8. set statusline=%f%m%r%h%w\ [%n:%{&ff}/%Y]%=[0x\%04.4B][%03v][%p%%\ line\ %l\ of\ %L,\ %{CharCount()}]
Advertisement
Add Comment
Please, Sign In to add comment