From ae474483e735efbcb07126ccc624e7c09488568f Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 16 Jul 2012 14:35:24 -0700 Subject: [PATCH 1/2] Whitespace fix --- autoload/youcompleteme.vim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 8d20e02b..6471b44b 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -154,19 +154,19 @@ function! youcompleteme#Complete(findstart, base) return [] endif - py csystem.CandidatesForQueryAsync( vim.eval('a:base') ) + py csystem.CandidatesForQueryAsync( vim.eval('a:base') ) - let l:results_ready = 0 - while !l:results_ready + let l:results_ready = 0 + while !l:results_ready py << EOF results_ready = csystem.AsyncCandidateRequestReady() if results_ready: vim.command( 'let l:results_ready = 1' ) EOF - if complete_check() - return { 'words' : [], 'refresh' : 'always'} - endif - endwhile + if complete_check() + return { 'words' : [], 'refresh' : 'always'} + endif + endwhile let l:results = [] py << EOF @@ -180,7 +180,7 @@ EOF " 7.3.475. It's possible that patch 404 was the one that fixed this issue, " but I haven't tested this assumption. " A bug in vim causes the '.' register to break when we use set this... sigh - return { 'words' : l:results, 'refresh' : 'always'} + return { 'words' : l:results, 'refresh' : 'always'} endif endfunction From be41be5323c25f4b3d793b7e66721e8aa8966c47 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 16 Jul 2012 14:44:50 -0700 Subject: [PATCH 2/2] Can now ignore filetypes plugin-wide --- autoload/youcompleteme.vim | 6 +++++- plugin/youcompleteme.vim | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 6471b44b..d4f2d8e7 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -22,10 +22,14 @@ set cpo&vim " This needs to be called outside of a function let s:script_folder_path = escape( expand( ':p:h' ), '\' ) let s:old_cursor_text = '' -let g:ycm_min_num_of_chars_for_completion = 2 " Set up the plugin, load all our modules, bind our keys etc. function! youcompleteme#Enable() + " If the user set the current filetype as a filetype that YCM should ignore, + " then we don't do anything + if get( g:ycm_filetypes_to_ignore, &filetype, 0 ) + return + endif augroup youcompleteme autocmd! diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index fd16f466..370bd6c7 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -20,6 +20,14 @@ if exists("g:loaded_youcompleteme") endif let g:loaded_youcompleteme = 1 +if !exists( 'g:ycm_min_num_of_chars_for_completion' ) + let g:ycm_min_num_of_chars_for_completion = 2 +endif + +if !exists( 'g:ycm_filetypes_to_ignore' ) + let g:ycm_filetypes_to_ignore = { 'notes' : 1 } +endif + " This is basic vim plugin boilerplate let s:save_cpo = &cpo set cpo&vim