From 4d252902c9f1d1a3431444fe59d983c275f1bd10 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 20 Jun 2016 22:39:44 +0900 Subject: [PATCH] Revert "Feed 'a' only when Neovim terminal is used" This reverts commit a48a9e806408e917715f733c7ef7b0daa17101cd. --- autoload/fzf/vim.vim | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index a18042f..3be2511 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -709,16 +709,9 @@ function! s:format_cmd(line) \ '\=s:nbs.s:yellow(submatch(1), "Function").s:nbs', '') endfunction -function! s:command_sink(lines) - if len(a:lines) < 2 - return - endif - let cmd = matchstr(a:lines[1], s:nbs.'\zs\S*\ze'.s:nbs) - if a:lines[0] == 'ctrl-x' - execute cmd - else - call feedkeys(':'.cmd.(a:lines[1] == '!' ? '' : ' ')) - endif +function! s:command_sink(cmd) + let cmd = matchstr(a:cmd, s:nbs.'\zs\S*\ze'.s:nbs) + call feedkeys(':'.cmd.(a:cmd[0] == '!' ? '' : ' ')) endfunction function! s:format_excmd(ex) @@ -759,8 +752,8 @@ function! fzf#vim#commands(...) let list = split(cout, "\n") return s:fzf({ \ 'source': extend(extend(list[0:0], map(list[1:], 's:format_cmd(v:val)')), s:excmds()), - \ 'sink*': s:function('s:command_sink'), - \ 'options': '--ansi --expect ctrl-x --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000) + \ 'sink': s:function('s:command_sink'), + \ 'options': '--ansi --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000) endfunction " ------------------------------------------------------------------ @@ -1032,8 +1025,8 @@ function! s:complete_insert(lines) let data = call(s:reducer, [a:lines]) execute 'normal!' ((s:eol || empty(chars)) ? '' : 'h').del.(s:eol ? 'a': 'i').data - if mode() =~ 't' - call feedkeys('a', 'n') + if has('nvim') + call feedkeys('a') else execute "normal! \la" endif