Deoplete.nvim: Close preview window after completion?

Created on 7 Jan 2016  路  6Comments  路  Source: Shougo/deoplete.nvim

Is there a way to automatically close the preview window after a completion is made?

Most helpful comment

I think you should use echodoc....

@beezz

autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif

is better.

All 6 comments

Hi Torworl,

e.g. from my .vimrc

" close preview window on leaving the insert mode
autocmd InsertLeave * if pumvisible() == 0 | pclose | endif

Deoplete does not have an option for this.

I think you should use echodoc....

@beezz

autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif

is better.

Thanks guys.

Does this autocommand:

autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif

Not give you the error:

Error detected while processing InsertLeave Auto commands for "*":                                                                                                                    
E11: Invalid in command-line window; <CR> executes, CTRL-C quits:  pclose | endif

When you exit insert mode from the command-line window, because of the pclose?

To reproduce:

:<C-F>i<Esc>

I was trying to figure out a way to do a mapping like this without this error.

When you exit insert mode from the command-line window, because of the pclose?

Yes.

Please read the documentation.

Q: I want to close the preview window after completion is done.

A: >
        autocmd CompleteDone * silent! pclose!
<
Or
>
    autocmd InsertLeave * silent! pclose!
<

You must use silent! pclose instead of pclose.

autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | silent! pclose | endif
Was this page helpful?
0 / 5 - 0 ratings