debug.vim 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. function! gitgutter#debug#debug()
  2. " Open a scratch buffer
  3. vsplit __GitGutter_Debug__
  4. normal! ggdG
  5. setlocal buftype=nofile
  6. setlocal bufhidden=delete
  7. setlocal noswapfile
  8. call gitgutter#debug#vim_version()
  9. call gitgutter#debug#separator()
  10. call gitgutter#debug#git_version()
  11. call gitgutter#debug#separator()
  12. call gitgutter#debug#option('updatetime')
  13. call gitgutter#debug#option('shell')
  14. call gitgutter#debug#option('shellcmdflag')
  15. call gitgutter#debug#option('shellpipe')
  16. call gitgutter#debug#option('shellquote')
  17. call gitgutter#debug#option('shellredir')
  18. call gitgutter#debug#option('shellslash')
  19. call gitgutter#debug#option('shelltemp')
  20. call gitgutter#debug#option('shelltype')
  21. call gitgutter#debug#option('shellxescape')
  22. call gitgutter#debug#option('shellxquote')
  23. endfunction
  24. function! gitgutter#debug#separator()
  25. call gitgutter#debug#output('')
  26. endfunction
  27. function! gitgutter#debug#vim_version()
  28. redir => version_info
  29. silent execute 'version'
  30. redir END
  31. call gitgutter#debug#output(split(version_info, '\n')[0:2])
  32. endfunction
  33. function! gitgutter#debug#git_version()
  34. let v = system('git --version')
  35. call gitgutter#debug#output( substitute(v, '\n$', '', '') )
  36. endfunction
  37. function! gitgutter#debug#option(name)
  38. if exists('+' . a:name)
  39. let v = eval('&' . a:name)
  40. call gitgutter#debug#output(a:name . '=' . v)
  41. " redir => output
  42. " silent execute "verbose set " . a:name . "?"
  43. " redir END
  44. " call gitgutter#debug#output(a:name . '=' . output)
  45. else
  46. call gitgutter#debug#output(a:name . ' [n/a]')
  47. end
  48. endfunction
  49. function! gitgutter#debug#output(text)
  50. call append(line('$'), a:text)
  51. endfunction
  52. function! gitgutter#debug#log(message)
  53. let msg = type(a:message) == 1 ? split(a:message, '\n') : a:message
  54. call writefile(msg, 'gitgutter.log', 'a')
  55. endfunction