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 (fzf-normal) -noremap! (fzf-normal) +nnoremap (fzf-insert) i +nnoremap (fzf-normal) if exists(':tnoremap') - tnoremap (fzf-normal) &filetype == 'fzf' ? "\" : "\\" + tnoremap (fzf-insert) + tnoremap (fzf-normal) 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("\(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' ? "\(fzf-insert)" : "\(fzf-normal)") + endif endfunction try