From 01b88539ba912da4f49cfba48e2a736c04ec6006 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 4 Oct 2016 00:20:36 +0900 Subject: [PATCH] [vim] Apply --multi and --prompt to :FZF command --- README.md | 2 +- plugin/fzf.vim | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5a90bdb..997ec7c 100644 --- a/README.md +++ b/README.md @@ -305,7 +305,7 @@ If you have set up fzf for Vim, `:FZF` command will be added. :FZF ~ " With options -:FZF --no-sort -m /tmp +:FZF --no-sort --reverse --inline-info /tmp " Bang version starts in fullscreen instead of using tmux pane or Neovim split :FZF! diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 8e3859d..2eb98d4 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -558,11 +558,15 @@ let s:default_action = { function! s:cmd(bang, ...) abort let args = copy(a:000) - let opts = {} + let opts = { 'options': '--multi ' } if len(args) && isdirectory(expand(args[-1])) - let opts.dir = substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g') + let opts.dir = substitute(substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g'), '/*$', '/', '') + let opts.options .= ' --prompt '.shellescape(opts.dir) + else + let opts.options .= ' --prompt '.shellescape(pathshorten(getcwd()).'/') endif - call fzf#run(fzf#wrap('FZF', extend({'options': join(args)}, opts), a:bang)) + let opts.options .= ' '.join(args) + call fzf#run(fzf#wrap('FZF', opts, a:bang)) endfunction command! -nargs=* -complete=dir -bang FZF call s:cmd(0, )