diff options
author | lacygoill <lacygoill@users.noreply.github.com> | 2020-03-29 19:06:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-30 02:06:06 +0900 |
commit | 0f5c6e8f040833ca632bb5ff345542879769225c (patch) | |
tree | e3c422599ef144f43f5e73be81831b0cb4d96a82 | |
parent | b1b916ce157df4fe1299edfdd012676419e2263c (diff) |
[vim] Fix issue with multiple popups (#1927)
Invoking fzf from an existing Vim popup terminal is a special case.
It requires some new code to avoid E994 from being raised and the user
being stuck in a non-closable popup window.
Fix #1916
-rw-r--r-- | plugin/fzf.vim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 6fa3d14d..83734aee 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -651,7 +651,7 @@ function! s:calc_size(max, val, dict) endfunction function! s:getpos() - return {'tab': tabpagenr(), 'win': winnr(), 'cnt': winnr('$'), 'tcnt': tabpagenr('$')} + return {'tab': tabpagenr(), 'win': winnr(), 'winid': win_getid(), 'cnt': winnr('$'), 'tcnt': tabpagenr('$')} endfunction function! s:split(dict) @@ -727,8 +727,8 @@ function! s:execute_term(dict, command, temps) abort " there's no other listed buffer (nvim +'set nobuflisted') close endif - execute 'tabnext' self.ppos.tab - execute self.ppos.win.'wincmd w' + silent! execute 'tabnext' self.ppos.tab + silent! execute self.ppos.win.'wincmd w' endif if bufexists(self.buf) @@ -837,7 +837,7 @@ if has('nvim') else function! s:create_popup(hl, opts) abort let is_frame = has_key(a:opts, 'border') - let buf = is_frame ? '' : term_start(&shell, #{hidden: 1}) + let buf = is_frame ? '' : term_start(&shell, #{hidden: 1, term_finish: 'close'}) let id = popup_create(buf, #{ \ line: a:opts.row, \ col: a:opts.col, @@ -851,7 +851,7 @@ else call setbufline(winbufnr(id), 1, a:opts.border) execute 'autocmd BufWipeout * ++once call popup_close('..id..')' else - execute 'autocmd BufWipeout * ++once bwipeout! '..buf + execute 'autocmd BufWipeout * ++once call term_sendkeys('..buf..', "exit\<CR>")' endif return winbufnr(id) endfunction |