Adding 'preview' to completeopt if not forbidden

The user can opt-out of this, but we set it by default since most people don't
know that the option exists. Those that are annoyed by it can just toggle an
option in their vimrc.
This commit is contained in:
Strahinja Val Markovic 2012-08-05 19:55:06 -07:00
parent 5f95a2bfde
commit 15561b9f1e
2 changed files with 12 additions and 4 deletions

View File

@ -38,10 +38,6 @@ function! youcompleteme#Enable()
return
endif
if g:ycm_allow_changing_updatetime
set ut=2000
endif
augroup youcompleteme
autocmd!
autocmd CursorMovedI * call s:OnCursorMovedInsertMode()
@ -68,6 +64,14 @@ function! youcompleteme#Enable()
" Also, having this option set breaks the plugin.
set completeopt-=longest
if g:ycm_add_preview_to_completeopt
set completeopt+=preview
endif
if g:ycm_allow_changing_updatetime
set ut=2000
endif
" With this command, when the completion window is visible, the tab key will
" select the next candidate in the window. In vim, this also changes the
" typed-in text to that of the candidate completion.

View File

@ -37,12 +37,16 @@ let g:ycm_min_num_of_chars_for_completion =
let g:ycm_filetypes_to_ignore =
\ get( g:, 'ycm_filetypes_to_ignore', { 'notes' : 1 } )
" TODO: make this more granular
let g:ycm_filetype_completion_enabled =
\ get( g:, 'ycm_filetype_completion_enabled', 1 )
let g:ycm_allow_changing_updatetime =
\ get( g:, 'ycm_allow_changing_updatetime', 1 )
let g:ycm_add_preview_to_completeopt =
\ get( g:, 'ycm_add_preview_to_completeopt', 1 )
" This is basic vim plugin boilerplate
let s:save_cpo = &cpo