mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-06-09 10:42:24 +00:00
[vim] Call feedkeys only when the destination buffer is a terminal
Fix #2352 Fix https://github.com/junegunn/fzf.vim/issues/1216 Close #2364
This commit is contained in:
parent
a367dfb22e
commit
dea950c2c8
|
@ -764,10 +764,11 @@ function! s:split(dict)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
noremap <silent> <Plug>(fzf-normal) <Nop>
|
nnoremap <silent> <Plug>(fzf-insert) i
|
||||||
noremap! <silent> <Plug>(fzf-normal) <Nop>
|
nnoremap <silent> <Plug>(fzf-normal) <Nop>
|
||||||
if exists(':tnoremap')
|
if exists(':tnoremap')
|
||||||
tnoremap <silent> <expr> <Plug>(fzf-normal) &filetype == 'fzf' ? "\<C-L>" : "\<C-\>\<C-n>"
|
tnoremap <silent> <Plug>(fzf-insert) <Nop>
|
||||||
|
tnoremap <silent> <Plug>(fzf-normal) <C-\><C-n>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! s:execute_term(dict, command, temps) abort
|
function! s:execute_term(dict, command, temps) abort
|
||||||
|
@ -798,8 +799,6 @@ function! s:execute_term(dict, command, temps) abort
|
||||||
call self.switch_back(1)
|
call self.switch_back(1)
|
||||||
else
|
else
|
||||||
if bufnr('') == self.buf
|
if bufnr('') == self.buf
|
||||||
" Exit terminal mode first (see neovim#13769)
|
|
||||||
call feedkeys("\<Plug>(fzf-normal)")
|
|
||||||
" We use close instead of bd! since Vim does not close the split when
|
" We use close instead of bd! since Vim does not close the split when
|
||||||
" there's no other listed buffer (nvim +'set nobuflisted')
|
" there's no other listed buffer (nvim +'set nobuflisted')
|
||||||
close
|
close
|
||||||
|
@ -824,6 +823,10 @@ function! s:execute_term(dict, command, temps) abort
|
||||||
call s:pushd(self.dict)
|
call s:pushd(self.dict)
|
||||||
call s:callback(self.dict, lines)
|
call s:callback(self.dict, lines)
|
||||||
call self.switch_back(s:getpos() == self.ppos)
|
call self.switch_back(s:getpos() == self.ppos)
|
||||||
|
|
||||||
|
if &buftype == 'terminal'
|
||||||
|
call feedkeys(&filetype == 'fzf' ? "\<Plug>(fzf-insert)" : "\<Plug>(fzf-normal)")
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue
Block a user