Created
September 16, 2015 18:11
-
-
Save davidmh/bc21331b95ae6c9fe280 to your computer and use it in GitHub Desktop.
reverse-i-search for vim with fzf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" reverse-i-search | |
function! s:get_history() | |
redir => history | |
silent! history | |
redir END | |
return map(split(history, '\n'), "strpart(v:val, 9)") | |
endfunction | |
function! s:run_cmd(cmd) | |
execute a:cmd | |
endfunction | |
command! FZFCmds call fzf#run({ | |
\ 'source': <sid>get_history(), | |
\ 'sink': function('<sid>run_cmd'), | |
\ 'options': '-x --tac +s --prompt="cmd >"', | |
\ 'right': '40%'}) | |
nnoremap <leader>r :FZFCmds<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment