Skip to content
Myr

Update Vim plugin

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Changes: - Rename g:fzf_command to g:fzf_source - Support multi-select mode - Add fzf#run(vim_command, fzf_args) function Todo: - Faster startup with --disable-gems option when available

authored by Junegunn Choi · committed by Junegunn Choi · parent be3b948 · Browse files · 2 files+28 added−14 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+28 added−14 removed

  • other:+28 added−14 removed

2 files+28 added−14 removed

modified:plugin/fzf.vim+13 added-11 removed
21 unmodified lines
22" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.2324let s:exec = expand('<sfile>:h:h').'/fzf'2526function! s:fzf(args)26function! fzf#run(command, args)27 try28 let tf = tempname()29 let prefix = exists('g:fzf_command') ? g:fzf_command.'|' : ''30 let fzf = executable(s:exec) ? s:exec : 'fzf'31 execute "silent !".prefix.fzf." ".a:args." > ".tf28 let tf = tempname()29 let prefix = exists('g:fzf_source') ? g:fzf_source.'|' : ''30 let fzf = executable(s:exec) ? s:exec : 'fzf'31 let options = empty(a:args) ? get(g:, 'fzf_options', '') : a:args32 execute "silent !".prefix.fzf.' '.options." > ".tf33 if !v:shell_error33 let file = join(readfile(tf), '')34 if !empty(file)35 execute 'silent e '.file36 endif34 for line in readfile(tf)35 if !empty(line)36 execute a:command.' '.line37 endif38 endfor39 endif40 finally39 silent! call delete(tf)41 redraw!42 silent! call delete(tf)43 endtry44endfunction4544command! -nargs=* FZF call s:fzf(<q-args>)46command! -nargs=* FZF call fzf#run('silent e', <q-args>)47
modified:README.md+15 added-3 removed
137 unmodified lines
138If you install fzf as a Vim plugin, `:FZF` command will be added.139140```vim141:FZF142:FZF --no-sort142:FZF --no-sort -m143```144145You can override the command which produces input to fzf.145You can override the source command which produces input to fzf.146147```vim148let g:fzf_command = 'find . -type f'148let g:fzf_source = 'find . -type f'149```150151And you can predefine default options to fzf command.152153```vim154let g:fzf_options = '--no-color --extended'155```156157For more advanced uses, you can call `fzf#run` function as follows.158159```vim160:call fzf#run('tabedit', '-m +c')161```162163Most of the time, you will prefer native Vim plugins with better integration164with Vim. The only reason one might consider using fzf in Vim is its speed. For165a very large list of files, fzf is significantly faster and it does not block.166
114 unmodified lines