From 1e40de4f2d5655b76ca4b5b1e387e1034d1815fa Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 20 Aug 2017 09:11:42 -0400 Subject: [PATCH] [Tags, BTags] Windows support (#427) --- autoload/fzf/vim.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index a3b11a0..e86b32e 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -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