[Tags, BTags] Windows support (#427)

This commit is contained in:
Jan Edmund Lazo 2017-08-20 09:11:42 -04:00 committed by Junegunn Choi
parent 61bcdb146f
commit 1e40de4f2d

View file

@ -717,9 +717,11 @@ endfunction
" query, [[tag commands], options]
function! fzf#vim#buffer_tags(query, ...)
let args = copy(a:000)
let escaped = fzf#shellescape(expand('%'))
let null = s:is_win ? 'nul' : '/dev/null'
let tag_cmds = (len(args) > 1 && type(args[0]) != type({})) ? remove(args, 0) : [
\ printf('ctags -f - --sort=no --excmd=number --language-force=%s %s 2>/dev/null', &filetype, expand('%:S')),
\ printf('ctags -f - --sort=no --excmd=number %s 2>/dev/null', expand('%:S'))]
\ printf('ctags -f - --sort=no --excmd=number --language-force=%s %s 2> %s', &filetype, escaped, null),
\ printf('ctags -f - --sort=no --excmd=number %s 2> %s', escaped, null)]
if type(tag_cmds) != type([])
let tag_cmds = [tag_cmds]
endif
@ -786,7 +788,7 @@ function! fzf#vim#tags(query, ...)
redraw
if gen =~? '^y'
call s:warn('Preparing tags')
call system(get(g:, 'fzf_tags_command', 'ctags -R'))
call system(get(g:, 'fzf_tags_command', 'ctags -R'.(s:is_win ? ' --output-format=e-ctags' : '')))
if empty(tagfiles())
return s:warn('Failed to create tags')
endif
@ -806,7 +808,7 @@ function! fzf#vim#tags(query, ...)
let opts = v2_limit < 0 ? '--algo=v1 ' : ''
return s:fzf('tags', {
\ 'source': shellescape(s:bin.tags).' '.join(map(tagfiles, 'shellescape(fnamemodify(v:val, ":p"))')),
\ 'source': fzf#shellescape(s:bin.tags).' '.join(map(tagfiles, 'fzf#shellescape(fnamemodify(v:val, ":p"))')),
\ 'sink*': s:function('s:tags_sink'),
\ 'options': opts.'--nth 1..2 -m --tiebreak=begin --prompt "Tags> "'.s:q(a:query)}, a:000)
endfunction