Option to auto-close preview window on select
The option defaults to off. Some people may find it useful.
This commit is contained in:
parent
658e1393b4
commit
5a9d304c87
@ -128,6 +128,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:OnCursorMovedInsertMode()
|
function! s:OnCursorMovedInsertMode()
|
||||||
call s:IdentifierFinishedOperations()
|
call s:IdentifierFinishedOperations()
|
||||||
|
call s:ClosePreviewWindowIfNeeded()
|
||||||
call s:InvokeCompletion()
|
call s:InvokeCompletion()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -141,6 +142,20 @@ function! s:OnInsertLeave()
|
|||||||
let s:omnifunc_mode = 0
|
let s:omnifunc_mode = 0
|
||||||
call s:UpdateDiagnosticNotifications()
|
call s:UpdateDiagnosticNotifications()
|
||||||
py ycm_state.OnInsertLeave()
|
py ycm_state.OnInsertLeave()
|
||||||
|
call s:ClosePreviewWindowIfNeeded()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:ClosePreviewWindowIfNeeded()
|
||||||
|
if !g:ycm_autoclose_preview_window_after_completion
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:searched_and_no_results_found
|
||||||
|
" This command does the actual closing of the preview window. If no preview
|
||||||
|
" window is shown, nothing happens.
|
||||||
|
pclose
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -222,6 +237,7 @@ function! s:CompletionsForQuery( query, use_filetype_completer )
|
|||||||
while !l:results_ready
|
while !l:results_ready
|
||||||
let l:results_ready = pyeval( 'completer.AsyncCandidateRequestReady()' )
|
let l:results_ready = pyeval( 'completer.AsyncCandidateRequestReady()' )
|
||||||
if complete_check()
|
if complete_check()
|
||||||
|
let s:searched_and_no_results_found = 0
|
||||||
return { 'words' : [], 'refresh' : 'always'}
|
return { 'words' : [], 'refresh' : 'always'}
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
|
@ -47,6 +47,8 @@ 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', 1 )
|
\ get( g:, 'ycm_add_preview_to_completeopt', 1 )
|
||||||
|
|
||||||
|
let g:ycm_autoclose_preview_window_after_completion =
|
||||||
|
\ get( g:, 'ycm_autoclose_preview_window_after_completion', 0 )
|
||||||
|
|
||||||
" This is basic vim plugin boilerplate
|
" This is basic vim plugin boilerplate
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
|
Loading…
Reference in New Issue
Block a user