Guest User

Untitled

a guest
Nov 10th, 2018
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function! WordCount()
  2.   let s:old_status = v:statusmsg
  3.   let position = getpos(".")
  4.   exe ":silent normal g\<C-g>"
  5.   let stat = v:statusmsg
  6.   let s:word_count = 0
  7.   if stat != '--No lines in buffer--'
  8.     let s:word_count = str2nr(split(v:statusmsg)[11])
  9.     let v:statusmsg = s:old_status
  10.   end
  11.   call setpos('.', position)
  12.   return s:word_count
  13. endfunction
  14.  
  15. set statusline=   " clear the statusline for when vimrc is reloaded
  16. set statusline+=%-3.3n\                      " buffer number
  17. set statusline+=%f\                          " file name
  18. set statusline+=%h%m%r%w                     " flags
  19. set statusline+=[%{strlen(&ft)?&ft:'none'},  " filetype
  20. set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding
  21. set statusline+=%{&fileformat}]              " file format
  22. set statusline+=%10.10{WordCount()}w\   " wordcount
  23. set statusline+=%=                           " right align
  24. set statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\  " highlight
  25. "set statusline+=%b,0x%-8B\                  " current char
  26. set statusline+=%-14.(%l,%c%V%)\ %<%P        " offset
  27. set noruler         "
  28. set laststatus=2    " show statusline
RAW Paste Data