fonctions.vim 573 B

1234567891011121314151617181920212223242526272829303132
  1. function! FileSize()
  2. let bytes = getfsize(expand('%:p'))
  3. if bytes <= 0
  4. return ''
  5. endif
  6. if bytes < 1024
  7. return bytes
  8. else
  9. return (bytes / 1024) . 'k'
  10. endif
  11. endfunction
  12. function! HunkSummary()
  13. if !get(g:, 'gitgutter_enabled', 0)
  14. return ''
  15. endif
  16. let l:summary = GitGutterGetHunkSummary()
  17. return '+'.l:summary[0].' ~'.l:summary[1].' -'.l:summary[2]
  18. endfunction
  19. function! PasteToggleMode()
  20. let g:pastemode = !g:pastemode
  21. if g:pastemode == 1
  22. set paste
  23. echo "paste"
  24. else
  25. set nopaste
  26. echo "nopaste"
  27. endif
  28. endfunction