Option to complete inside comments and strings.

Fixes issue #105.
This commit is contained in:
Strahinja Val Markovic 2013-02-16 12:56:21 -08:00
parent 90dc16bb99
commit 3f1b5c9283
3 changed files with 16 additions and 0 deletions

View File

@ -523,6 +523,15 @@ Default: `1`
let g:ycm_allow_changing_updatetime = 1 let g:ycm_allow_changing_updatetime = 1
### The `g:ycm_complete_in_comments_and_strings` option
When this option is set to `1`, YCM will show the completion menu even when
typing inside strings and comments.
Default: `0`
let g:ycm_complete_in_comments_and_strings = 0
### The `g:ycm_add_preview_to_completeopt` option ### The `g:ycm_add_preview_to_completeopt` option
When this option is set to `1`, YCM will add the `preview` string to Vim's When this option is set to `1`, YCM will add the `preview` string to Vim's

View File

@ -331,6 +331,10 @@ endfunction
function! s:InsideCommentOrString() function! s:InsideCommentOrString()
if g:ycm_complete_in_comments_and_strings
return 0
endif
" Has to be col('.') -1 because col('.') doesn't exist at this point. We are " Has to be col('.') -1 because col('.') doesn't exist at this point. We are
" in insert mode when this func is called. " in insert mode when this func is called.
let syntax_group = synIDattr( synIDtrans( synID( line( '.' ), col( '.' ) - 1, 1 ) ), 'name') let syntax_group = synIDattr( synIDtrans( synID( line( '.' ), col( '.' ) - 1, 1 ) ), 'name')

View File

@ -74,6 +74,9 @@ let g:ycm_allow_changing_updatetime =
let g:ycm_add_preview_to_completeopt = let g:ycm_add_preview_to_completeopt =
\ get( g:, 'ycm_add_preview_to_completeopt', 0 ) \ get( g:, 'ycm_add_preview_to_completeopt', 0 )
let g:ycm_complete_in_comments_and_strings =
\ get( g:, 'ycm_complete_in_comments_and_strings', 0 )
let g:ycm_autoclose_preview_window_after_completion = let g:ycm_autoclose_preview_window_after_completion =
\ get( g:, 'ycm_autoclose_preview_window_after_completion', 0 ) \ get( g:, 'ycm_autoclose_preview_window_after_completion', 0 )