While there is <up> and <down> that tries to complete the line, sometimes one wants to recall all the commands that start with what was typed, on a (wild)menu.

Is this possible somehow?

1 Answer 1


I was able to use FZF to complete the command by using the command history.

Unfortunately, I had to get out of the command line to do so, but it still fairly comfortable. I could edit the command afterwards if I want to.

function! GetCommands()
    let lines=[]
    let nu=histnr("cmd")
    for i in range(1,nu)
        let lines+=[histget("cmd",i)]
    return lines

function! HandleCommand(item)
    call feedkeys("q:")
    call feedkeys("G?\\V".escape(a:item,'\/?')."\<CR>")

function! CompleteCommand(arg)
call fzf#run({'source': GetCommands(),'sink': function('HandleCommand'),'options': '-m --query "'.a:arg.'"'} ) 

:cmap <expr> <c-a> &cedit.'^"xy$'."<esc><esc>:call CompleteCommand(@x)<CR>"

:autocmd CmdwinEnter * map <buffer> <ESC> <C-c><C-c>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.