[BTags] Try --language-force option the first time
This commit is contained in:
parent
8e4536384b
commit
4dd84d7165
1 changed files with 15 additions and 4 deletions
|
@ -379,11 +379,22 @@ endfunction
|
||||||
" BTags
|
" BTags
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
function! s:btags_source()
|
function! s:btags_source()
|
||||||
let lines = map(split(system(printf(
|
if !filereadable(expand('%'))
|
||||||
\ 'ctags -f - --sort=no --excmd=number %s',
|
throw 'Save the file first'
|
||||||
\ expand('%:S'))), "\n"), 'split(v:val, "\t")')
|
endif
|
||||||
|
|
||||||
|
for cmd in [
|
||||||
|
\ printf('ctags -f - --sort=no --excmd=number --language-force=%s %s', &filetype, expand('%:S')),
|
||||||
|
\ printf('ctags -f - --sort=no --excmd=number %s', expand('%:S'))]
|
||||||
|
let lines = map(split(system(cmd), "\n"), 'split(v:val, "\t")')
|
||||||
|
if !v:shell_error
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
throw 'Failed to extract tags'
|
throw get(lines, 0, 'Failed to extract tags')
|
||||||
|
elseif empty(lines)
|
||||||
|
throw 'No tags found'
|
||||||
endif
|
endif
|
||||||
return map(s:align_lists(lines), 'join(v:val, "\t")')
|
return map(s:align_lists(lines), 'join(v:val, "\t")')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
Loading…
Add table
Reference in a new issue