mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-07 13:14:30 +08:00
[Tags, BTags] Windows support (#427)
This commit is contained in:
committed by
Junegunn Choi
parent
61bcdb146f
commit
1e40de4f2d
@@ -717,9 +717,11 @@ endfunction
|
|||||||
" query, [[tag commands], options]
|
" query, [[tag commands], options]
|
||||||
function! fzf#vim#buffer_tags(query, ...)
|
function! fzf#vim#buffer_tags(query, ...)
|
||||||
let args = copy(a:000)
|
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) : [
|
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 --language-force=%s %s 2> %s', &filetype, escaped, null),
|
||||||
\ printf('ctags -f - --sort=no --excmd=number %s 2>/dev/null', expand('%:S'))]
|
\ printf('ctags -f - --sort=no --excmd=number %s 2> %s', escaped, null)]
|
||||||
if type(tag_cmds) != type([])
|
if type(tag_cmds) != type([])
|
||||||
let tag_cmds = [tag_cmds]
|
let tag_cmds = [tag_cmds]
|
||||||
endif
|
endif
|
||||||
@@ -786,7 +788,7 @@ function! fzf#vim#tags(query, ...)
|
|||||||
redraw
|
redraw
|
||||||
if gen =~? '^y'
|
if gen =~? '^y'
|
||||||
call s:warn('Preparing tags')
|
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())
|
if empty(tagfiles())
|
||||||
return s:warn('Failed to create tags')
|
return s:warn('Failed to create tags')
|
||||||
endif
|
endif
|
||||||
@@ -806,7 +808,7 @@ function! fzf#vim#tags(query, ...)
|
|||||||
let opts = v2_limit < 0 ? '--algo=v1 ' : ''
|
let opts = v2_limit < 0 ? '--algo=v1 ' : ''
|
||||||
|
|
||||||
return s:fzf('tags', {
|
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'),
|
\ 'sink*': s:function('s:tags_sink'),
|
||||||
\ 'options': opts.'--nth 1..2 -m --tiebreak=begin --prompt "Tags> "'.s:q(a:query)}, a:000)
|
\ 'options': opts.'--nth 1..2 -m --tiebreak=begin --prompt "Tags> "'.s:q(a:query)}, a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user