Merge pull request #189 from fwalch/autoclose_preview_window_after_insertion
Added option to close the preview window after leaving insert mode
This commit is contained in:
commit
6d53c1cf5a
15
README.md
15
README.md
@ -617,6 +617,18 @@ Default: `0`
|
|||||||
|
|
||||||
let g:ycm_autoclose_preview_window_after_completion = 0
|
let g:ycm_autoclose_preview_window_after_completion = 0
|
||||||
|
|
||||||
|
### The `g:ycm_autoclose_preview_window_after_insertion` option
|
||||||
|
|
||||||
|
When this option is set to `1`, YCM will auto-close the `preview` window after
|
||||||
|
the user leaves insert mode. This option is irrelevant if
|
||||||
|
`g:ycm_autoclose_preview_window_after_completion` is set or if no `preview`
|
||||||
|
window is triggered. See the `g:ycm_add_preview_to_completeopt` option for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
Default: `0`
|
||||||
|
|
||||||
|
let g:ycm_autoclose_preview_window_after_insertion = 0
|
||||||
|
|
||||||
### The `g:ycm_max_diagnostics_to_display` option
|
### The `g:ycm_max_diagnostics_to_display` option
|
||||||
|
|
||||||
This option controls the maximum number of diagnostics shown to the user when
|
This option controls the maximum number of diagnostics shown to the user when
|
||||||
@ -787,7 +799,8 @@ types to write the function call.
|
|||||||
|
|
||||||
If you would like this window to auto-close after you select a completion
|
If you would like this window to auto-close after you select a completion
|
||||||
string, set the `g:ycm_autoclose_preview_window_after_completion` option to `1`
|
string, set the `g:ycm_autoclose_preview_window_after_completion` option to `1`
|
||||||
in your `vimrc` file.
|
in your `vimrc` file. Similarly, the `g:ycm_autoclose_preview_window_after_insertion`
|
||||||
|
option can be set to close the `preview` window after leaving insert mode.
|
||||||
|
|
||||||
If you don't want this window to ever show up, add `set completeopt-=preview` to
|
If you don't want this window to ever show up, add `set completeopt-=preview` to
|
||||||
your `vimrc`. Also make sure that the `g:ycm_add_preview_to_completeopt` option
|
your `vimrc`. Also make sure that the `g:ycm_add_preview_to_completeopt` option
|
||||||
|
@ -238,7 +238,9 @@ function! s:OnCursorMovedInsertMode()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
call s:IdentifierFinishedOperations()
|
call s:IdentifierFinishedOperations()
|
||||||
|
if g:ycm_autoclose_preview_window_after_completion
|
||||||
call s:ClosePreviewWindowIfNeeded()
|
call s:ClosePreviewWindowIfNeeded()
|
||||||
|
endif
|
||||||
call s:InvokeCompletion()
|
call s:InvokeCompletion()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -260,7 +262,10 @@ 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()
|
||||||
|
if g:ycm_autoclose_preview_window_after_completion ||
|
||||||
|
\ g:ycm_autoclose_preview_window_after_insertion
|
||||||
call s:ClosePreviewWindowIfNeeded()
|
call s:ClosePreviewWindowIfNeeded()
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -306,10 +311,6 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:ClosePreviewWindowIfNeeded()
|
function! s:ClosePreviewWindowIfNeeded()
|
||||||
if !g:ycm_autoclose_preview_window_after_completion
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if s:searched_and_results_found
|
if s:searched_and_results_found
|
||||||
" This command does the actual closing of the preview window. If no preview
|
" This command does the actual closing of the preview window. If no preview
|
||||||
" window is shown, nothing happens.
|
" window is shown, nothing happens.
|
||||||
|
@ -91,6 +91,9 @@ let g:ycm_collect_identifiers_from_comments_and_strings =
|
|||||||
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 )
|
||||||
|
|
||||||
|
let g:ycm_autoclose_preview_window_after_insertion =
|
||||||
|
\ get( g:, 'ycm_autoclose_preview_window_after_insertion', 0 )
|
||||||
|
|
||||||
let g:ycm_max_diagnostics_to_display =
|
let g:ycm_max_diagnostics_to_display =
|
||||||
\ get( g:, 'ycm_max_diagnostics_to_display', 30 )
|
\ get( g:, 'ycm_max_diagnostics_to_display', 30 )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user