Added flag to turn off clang completion if desired
This commit is contained in:
parent
cdb8dfc86b
commit
cfede619f2
@ -60,7 +60,10 @@ function! youcompleteme#Enable()
|
||||
exe 'python sys.path = sys.path + ["' . s:script_folder_path . '/../python"]'
|
||||
py import ycm
|
||||
py identcomp = ycm.IdentifierCompleter()
|
||||
|
||||
if g:ycm_clang_completion_enabled
|
||||
py clangcomp = ycm.ClangCompleter()
|
||||
endif
|
||||
|
||||
" Calling this once solves the problem of BufRead/BufEnter not triggering for
|
||||
" the first loaded file. This should be the last command executed in this
|
||||
|
@ -29,6 +29,9 @@ let g:loaded_youcompleteme = 1
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let g:ycm_clang_completion_enabled =
|
||||
\ get(g:, 'ycm_clang_completion_enabled', 1)
|
||||
|
||||
" On-demand loading. Let's use the autoload folder and not slow down vim's
|
||||
" startup procedure.
|
||||
augroup youcompletemeStart
|
||||
|
@ -22,6 +22,7 @@ import vim
|
||||
import indexer
|
||||
|
||||
MIN_NUM_CHARS = int( vim.eval( "g:ycm_min_num_of_chars_for_completion" ) )
|
||||
CLANG_COMPLETION_ENABLED = int( vim.eval( "g:ycm_clang_completion_enabled" ) )
|
||||
CLANG_FILETYPES = set( [ 'c', 'cpp', 'objc', 'objcpp' ] )
|
||||
MAX_IDENTIFIER_COMPLETIONS_RETURNED = 10
|
||||
|
||||
@ -211,6 +212,9 @@ def CurrentLineAndColumn():
|
||||
|
||||
|
||||
def ShouldUseClang( start_column ):
|
||||
if not CLANG_COMPLETION_ENABLED:
|
||||
return False
|
||||
|
||||
filetype = vim.eval( "&filetype" )
|
||||
if filetype not in CLANG_FILETYPES:
|
||||
return False
|
||||
@ -332,4 +336,3 @@ def RemoveIdentFreeText( text ):
|
||||
re.DOTALL | re.MULTILINE )
|
||||
|
||||
return re.sub( pattern, replacer, text )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user