youcompleteme.vim 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. " Copyright (C) 2011, 2012 Google Inc.
  2. "
  3. " This file is part of YouCompleteMe.
  4. "
  5. " YouCompleteMe is free software: you can redistribute it and/or modify
  6. " it under the terms of the GNU General Public License as published by
  7. " the Free Software Foundation, either version 3 of the License, or
  8. " (at your option) any later version.
  9. "
  10. " YouCompleteMe is distributed in the hope that it will be useful,
  11. " but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. " GNU General Public License for more details.
  14. "
  15. " You should have received a copy of the GNU General Public License
  16. " along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
  17. " This is basic vim plugin boilerplate
  18. let s:save_cpo = &cpo
  19. set cpo&vim
  20. function! s:restore_cpo()
  21. let &cpo = s:save_cpo
  22. unlet s:save_cpo
  23. endfunction
  24. if exists( "g:loaded_youcompleteme" )
  25. call s:restore_cpo()
  26. finish
  27. elseif v:version < 704 || (v:version == 704 && !has('patch143'))
  28. echohl WarningMsg |
  29. \ echomsg "YouCompleteMe unavailable: requires Vim 7.4.143+" |
  30. \ echohl None
  31. call s:restore_cpo()
  32. finish
  33. elseif !has( 'python' ) && !has( 'python3' )
  34. echohl WarningMsg |
  35. \ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
  36. \ "Python (2.6+ or 3.3+) support" |
  37. \ echohl None
  38. call s:restore_cpo()
  39. finish
  40. endif
  41. let g:loaded_youcompleteme = 1
  42. " NOTE: Most defaults are in third_party/ycmd/ycmd/default_settings.json. They
  43. " are loaded into Vim globals with the 'ycm_' prefix if such a key does not
  44. " already exist; thus, the user can override the defaults.
  45. " The only defaults that are here are the ones that are only relevant to the YCM
  46. " Vim client and not the ycmd server.
  47. let g:ycm_allow_changing_updatetime =
  48. \ get( g:, 'ycm_allow_changing_updatetime', 1 )
  49. let g:ycm_open_loclist_on_ycm_diags =
  50. \ get( g:, 'ycm_open_loclist_on_ycm_diags', 1 )
  51. let g:ycm_add_preview_to_completeopt =
  52. \ get( g:, 'ycm_add_preview_to_completeopt', 0 )
  53. let g:ycm_autoclose_preview_window_after_completion =
  54. \ get( g:, 'ycm_autoclose_preview_window_after_completion', 0 )
  55. let g:ycm_autoclose_preview_window_after_insertion =
  56. \ get( g:, 'ycm_autoclose_preview_window_after_insertion', 0 )
  57. let g:ycm_key_list_select_completion =
  58. \ get( g:, 'ycm_key_list_select_completion', ['<TAB>', '<Down>'] )
  59. let g:ycm_key_list_previous_completion =
  60. \ get( g:, 'ycm_key_list_previous_completion', ['<S-TAB>', '<Up>'] )
  61. let g:ycm_key_invoke_completion =
  62. \ get( g:, 'ycm_key_invoke_completion', '<C-Space>' )
  63. let g:ycm_key_detailed_diagnostics =
  64. \ get( g:, 'ycm_key_detailed_diagnostics', '<leader>d' )
  65. let g:ycm_cache_omnifunc =
  66. \ get( g:, 'ycm_cache_omnifunc', 1 )
  67. let g:ycm_log_level =
  68. \ get( g:, 'ycm_log_level',
  69. \ get( g:, 'ycm_server_log_level', 'info' ) )
  70. let g:ycm_keep_logfiles =
  71. \ get( g:, 'ycm_keep_logfiles',
  72. \ get( g:, 'ycm_server_keep_logfiles', 0 ) )
  73. let g:ycm_extra_conf_vim_data =
  74. \ get( g:, 'ycm_extra_conf_vim_data', [] )
  75. let g:ycm_server_python_interpreter =
  76. \ get( g:, 'ycm_server_python_interpreter',
  77. \ get( g:, 'ycm_path_to_python_interpreter', '' ) )
  78. let g:ycm_show_diagnostics_ui =
  79. \ get( g:, 'ycm_show_diagnostics_ui', 1 )
  80. let g:ycm_enable_diagnostic_signs =
  81. \ get( g:, 'ycm_enable_diagnostic_signs',
  82. \ get( g:, 'syntastic_enable_signs', 1 ) )
  83. let g:ycm_enable_diagnostic_highlighting =
  84. \ get( g:, 'ycm_enable_diagnostic_highlighting',
  85. \ get( g:, 'syntastic_enable_highlighting', 1 ) )
  86. let g:ycm_echo_current_diagnostic =
  87. \ get( g:, 'ycm_echo_current_diagnostic',
  88. \ get( g:, 'syntastic_echo_current_error', 1 ) )
  89. let g:ycm_always_populate_location_list =
  90. \ get( g:, 'ycm_always_populate_location_list',
  91. \ get( g:, 'syntastic_always_populate_loc_list', 0 ) )
  92. let g:ycm_error_symbol =
  93. \ get( g:, 'ycm_error_symbol',
  94. \ get( g:, 'syntastic_error_symbol', '>>' ) )
  95. let g:ycm_warning_symbol =
  96. \ get( g:, 'ycm_warning_symbol',
  97. \ get( g:, 'syntastic_warning_symbol', '>>' ) )
  98. let g:ycm_goto_buffer_command =
  99. \ get( g:, 'ycm_goto_buffer_command', 'same-buffer' )
  100. let g:ycm_disable_for_files_larger_than_kb =
  101. \ get( g:, 'ycm_disable_for_files_larger_than_kb', 1000 )
  102. call youcompleteme#Enable()
  103. " This is basic vim plugin boilerplate
  104. call s:restore_cpo()