[History] Append command to command history

Close #661
Fix #549
This commit is contained in:
Junegunn Choi
2018-06-22 12:13:32 +09:00
parent 6aa1db67a5
commit 1b01a5069b

View File

@@ -454,6 +454,7 @@ function! s:history_sink(type, lines)
return return
endif endif
let prefix = "\<plug>(-fzf-".a:type.')'
let key = a:lines[0] let key = a:lines[0]
let item = matchstr(a:lines[1], ' *[0-9]\+ *\zs.*') let item = matchstr(a:lines[1], ' *[0-9]\+ *\zs.*')
if key == 'ctrl-e' if key == 'ctrl-e'
@@ -461,13 +462,16 @@ function! s:history_sink(type, lines)
redraw redraw
call feedkeys(a:type."\<up>") call feedkeys(a:type."\<up>")
else else
let g:__fzf_command = "normal ".a:type.item."\<cr>" if a:type == ':'
call histadd(a:type, item)
endif
let g:__fzf_command = "normal ".prefix.item."\<cr>"
call feedkeys("\<plug>(-fzf-vim-do)") call feedkeys("\<plug>(-fzf-vim-do)")
endif endif
endfunction endfunction
function! s:cmd_history_sink(lines) function! s:cmd_history_sink(lines)
call s:history_sink("\<plug>(-fzf-:)", a:lines) call s:history_sink(':', a:lines)
endfunction endfunction
function! fzf#vim#command_history(...) function! fzf#vim#command_history(...)
@@ -478,7 +482,7 @@ function! fzf#vim#command_history(...)
endfunction endfunction
function! s:search_history_sink(lines) function! s:search_history_sink(lines)
call s:history_sink("\<plug>(-fzf-/)", a:lines) call s:history_sink('/', a:lines)
endfunction endfunction
function! fzf#vim#search_history(...) function! fzf#vim#search_history(...)