mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-03-01 21:07:01 +08:00
[fzf#vim#with_preview] works with Ag in Windows
- disabled on Files because the preview scripts cannot resolve the network drive - use 8.3 filepath for s:bin.preview to bypass escape issues in fzf binary
This commit is contained in:
@@ -35,6 +35,15 @@ let s:bin = {
|
|||||||
\ 'preview': s:bin_dir.(executable('ruby') ? 'preview.rb' : 'preview.sh'),
|
\ 'preview': s:bin_dir.(executable('ruby') ? 'preview.rb' : 'preview.sh'),
|
||||||
\ 'tags': s:bin_dir.'tags.pl' }
|
\ 'tags': s:bin_dir.'tags.pl' }
|
||||||
let s:TYPE = {'dict': type({}), 'funcref': type(function('call')), 'string': type(''), 'list': type([])}
|
let s:TYPE = {'dict': type({}), 'funcref': type(function('call')), 'string': type(''), 'list': type([])}
|
||||||
|
if s:is_win
|
||||||
|
if &shellslash
|
||||||
|
let s:bin.preview = fnamemodify(s:bin.preview, ':8')
|
||||||
|
else
|
||||||
|
set shellslash
|
||||||
|
let s:bin.preview = fnamemodify(s:bin.preview, ':8')
|
||||||
|
set noshellslash
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:merge_opts(dict, eopts)
|
function! s:merge_opts(dict, eopts)
|
||||||
if empty(a:eopts)
|
if empty(a:eopts)
|
||||||
@@ -64,9 +73,6 @@ function! fzf#vim#with_preview(...)
|
|||||||
let options = copy(args[0])
|
let options = copy(args[0])
|
||||||
call remove(args, 0)
|
call remove(args, 0)
|
||||||
endif
|
endif
|
||||||
if s:is_win
|
|
||||||
return options
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Preview window
|
" Preview window
|
||||||
if len(args) && type(args[0]) == s:TYPE.string
|
if len(args) && type(args[0]) == s:TYPE.string
|
||||||
@@ -199,6 +205,9 @@ function! s:fzf(name, opts, extra)
|
|||||||
let eopts = has_key(extra, 'options') ? remove(extra, 'options') : ''
|
let eopts = has_key(extra, 'options') ? remove(extra, 'options') : ''
|
||||||
let merged = extend(copy(a:opts), extra)
|
let merged = extend(copy(a:opts), extra)
|
||||||
call s:merge_opts(merged, eopts)
|
call s:merge_opts(merged, eopts)
|
||||||
|
if s:is_win && empty(get(merged, 'source', '')) && empty($FZF_DEFAULT_COMMAND) && get(merged, 'options', '') =~# s:bin.preview
|
||||||
|
return s:warn('preview script is incompatible with the default command in Windows')
|
||||||
|
endif
|
||||||
return fzf#run(s:wrap(a:name, merged, bang))
|
return fzf#run(s:wrap(a:name, merged, bang))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user