summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2021-02-21 23:57:33 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2021-02-22 00:22:12 +0900
commitdea950c2c82b8c44a123a1eb7a7cfa9c08048d8c (patch)
tree252dea6be2f66a4356839fd4c7e019c9a0e40c9f /plugin
parenta367dfb22e63e41b52f68056a7b3325bab3ba180 (diff)
[vim] Call feedkeys only when the destination buffer is a terminal
Fix #2352 Fix https://github.com/junegunn/fzf.vim/issues/1216 Close #2364
Diffstat (limited to 'plugin')
-rw-r--r--plugin/fzf.vim13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index a2db07cd..80d58223 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -764,10 +764,11 @@ function! s:split(dict)
endtry
endfunction
-noremap <silent> <Plug>(fzf-normal) <Nop>
-noremap! <silent> <Plug>(fzf-normal) <Nop>
+nnoremap <silent> <Plug>(fzf-insert) i
+nnoremap <silent> <Plug>(fzf-normal) <Nop>
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
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)
else
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
" there's no other listed buffer (nvim +'set nobuflisted')
close
@@ -824,6 +823,10 @@ function! s:execute_term(dict, command, temps) abort
call s:pushd(self.dict)
call s:callback(self.dict, lines)
call self.switch_back(s:getpos() == self.ppos)
+
+ if &buftype == 'terminal'
+ call feedkeys(&filetype == 'fzf' ? "\<Plug>(fzf-insert)" : "\<Plug>(fzf-normal)")
+ endif
endfunction
try