Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. let g:lightline = {
  2. \ 'colorscheme': 'material_vim',
  3. \ 'active': {
  4. \ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'fileformat', 'fileencoding', 'filetype' ] ],
  5. \ 'left': [ [ 'mode', 'paste' ], [ 'lsp_status' ], [ 'readonly', 'filename' ], [ 'lsp_info', 'lsp_hints', 'lsp_errors', 'lsp_warnings', 'lsp_ok' ] ],
  6. \ },
  7. \ 'component_function': { },
  8. \ 'tabline': {
  9. \ 'left': [ ['buffers'] ],
  10. \ 'right': [ ],
  11. \ },
  12. \ 'component_expand': {
  13. \ 'buffers': 'lightline#bufferline#buffers',
  14. \ },
  15. \ 'component_type': {
  16. \ 'buffers': 'tabsel',
  17. \ }
  18. \ }
  19. function! WordCount()
  20. let currentmode = mode()
  21. if !exists("g:lastmode_wc")
  22. let g:lastmode_wc = currentmode
  23. endif
  24. " if we modify file, open a new buffer, be in visual ever, or switch modes
  25. " since last run, we recompute.
  26. if &modified || !exists("b:wordcount") || currentmode =~? '\c.*v' || currentmode != g:lastmode_wc
  27. let g:lastmode_wc = currentmode
  28. let l:old_position = getpos('.')
  29. let l:old_status = v:statusmsg
  30. execute "silent normal g\<c-g>"
  31. if v:statusmsg == "--No lines in buffer--"
  32. let b:wordcount = 0
  33. else
  34. let s:split_wc = split(v:statusmsg)
  35. if index(s:split_wc, "Selected") < 0
  36. let b:wordcount = str2nr(s:split_wc[11])
  37. else
  38. let b:wordcount = str2nr(s:split_wc[5])
  39. endif
  40. let v:statusmsg = l:old_status
  41. endif
  42. call setpos('.', l:old_position)
  43. return b:wordcount
  44. else
  45. return b:wordcount
  46. endif
  47. endfunction
  48. let g:lightline#trailing_whitespace#indicator = ''
  49. call lightline#lsp#register()