My dotfiles. Period.

gutentags.vim 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. " gutentags.vim - Automatic ctags management for Vim
  2. " Maintainer: Ludovic Chabant <http://ludovic.chabant.com>
  3. " Version: 2.0.0
  4. " Globals {{{
  5. if (&cp || get(g:, 'gutentags_dont_load', 0))
  6. finish
  7. endif
  8. if v:version < 704
  9. echoerr "gutentags: this plugin requires vim >= 7.4."
  10. finish
  11. endif
  12. if !(has('job') || (has('nvim') && exists('*jobwait')))
  13. echoerr "gutentags: this plugin requires the job API from Vim8 or Neovim."
  14. finish
  15. endif
  16. let g:gutentags_debug = get(g:, 'gutentags_debug', 0)
  17. if (exists('g:loaded_gutentags') && !g:gutentags_debug)
  18. finish
  19. endif
  20. if (exists('g:loaded_gutentags') && g:gutentags_debug)
  21. echom "Reloaded gutentags."
  22. endif
  23. let g:loaded_gutentags = 1
  24. let g:gutentags_trace = get(g:, 'gutentags_trace', 0)
  25. let g:gutentags_fake = get(g:, 'gutentags_fake', 0)
  26. let g:gutentags_background_update = get(g:, 'gutentags_background_update', 1)
  27. let g:gutentags_pause_after_update = get(g:, 'gutentags_pause_after_update', 0)
  28. let g:gutentags_enabled = get(g:, 'gutentags_enabled', 1)
  29. let g:gutentags_modules = get(g:, 'gutentags_modules', ['ctags'])
  30. let g:gutentags_init_user_func = get(g:, 'gutentags_init_user_func',
  31. \get(g:, 'gutentags_enabled_user_func', ''))
  32. let g:gutentags_add_ctrlp_root_markers = get(g:, 'gutentags_add_ctrlp_root_markers', 1)
  33. let g:gutentags_add_default_project_roots = get(g:, 'gutentags_add_default_project_roots', 1)
  34. let g:gutentags_project_root = get(g:, 'gutentags_project_root', [])
  35. if g:gutentags_add_default_project_roots
  36. let g:gutentags_project_root += ['.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout']
  37. endif
  38. let g:gutentags_project_root_finder = get(g:, 'gutentags_project_root_finder', '')
  39. let g:gutentags_project_info = get(g:, 'gutentags_project_info', [])
  40. call add(g:gutentags_project_info, {'type': 'python', 'file': 'setup.py'})
  41. call add(g:gutentags_project_info, {'type': 'ruby', 'file': 'Gemfile'})
  42. let g:gutentags_exclude_filetypes = get(g:, 'gutentags_exclude_filetypes', [])
  43. let g:gutentags_exclude_project_root = get(g:, 'gutentags_exclude_project_root', ['/usr/local'])
  44. let g:gutentags_resolve_symlinks = get(g:, 'gutentags_resolve_symlinks', 0)
  45. let g:gutentags_generate_on_new = get(g:, 'gutentags_generate_on_new', 1)
  46. let g:gutentags_generate_on_missing = get(g:, 'gutentags_generate_on_missing', 1)
  47. let g:gutentags_generate_on_write = get(g:, 'gutentags_generate_on_write', 1)
  48. let g:gutentags_generate_on_empty_buffer = get(g:, 'gutentags_generate_on_empty_buffer', 0)
  49. let g:gutentags_file_list_command = get(g:, 'gutentags_file_list_command', '')
  50. let g:gutentags_use_jobs = get(g:, 'gutentags_use_jobs', has('job'))
  51. if !exists('g:gutentags_cache_dir')
  52. let g:gutentags_cache_dir = ''
  53. elseif !empty(g:gutentags_cache_dir)
  54. " Make sure we get an absolute/resolved path (e.g. expanding `~/`), and
  55. " strip any trailing slash.
  56. let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':p')
  57. let g:gutentags_cache_dir = fnamemodify(g:gutentags_cache_dir, ':s?[/\\]$??')
  58. endif
  59. let g:gutentags_define_advanced_commands = get(g:, 'gutentags_define_advanced_commands', 0)
  60. if g:gutentags_cache_dir != '' && !isdirectory(g:gutentags_cache_dir)
  61. call mkdir(g:gutentags_cache_dir, 'p')
  62. endif
  63. if has('win32')
  64. let g:gutentags_plat_dir = expand('<sfile>:h:h:p') . "\\plat\\win32\\"
  65. let g:gutentags_res_dir = expand('<sfile>:h:h:p') . "\\res\\"
  66. let g:gutentags_script_ext = '.cmd'
  67. else
  68. let g:gutentags_plat_dir = expand('<sfile>:h:h:p') . '/plat/unix/'
  69. let g:gutentags_res_dir = expand('<sfile>:h:h:p') . '/res/'
  70. let g:gutentags_script_ext = '.sh'
  71. endif
  72. " }}}
  73. " Gutentags Setup {{{
  74. augroup gutentags_detect
  75. autocmd!
  76. autocmd BufNewFile,BufReadPost * call gutentags#setup_gutentags()
  77. autocmd VimEnter * if expand('<amatch>')==''|call gutentags#setup_gutentags()|endif
  78. augroup end
  79. " }}}
  80. " Toggles and Miscellaneous Commands {{{
  81. if g:gutentags_define_advanced_commands
  82. command! GutentagsToggleEnabled :let g:gutentags_enabled=!g:gutentags_enabled
  83. command! GutentagsToggleTrace :call gutentags#toggletrace()
  84. endif
  85. if g:gutentags_debug
  86. command! GutentagsToggleFake :call gutentags#fake()
  87. endif
  88. " }}}