diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 1da6055..87324e0 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1390,11 +1390,6 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort let ctags_args += [ '-V' ] endif - " Include extra type definitions - if has_key(a:typeinfo, 'deffile') - let ctags_args += ['--options=' . expand(a:typeinfo.deffile)] - endif - " Third-party programs may not necessarily make use of this if has_key(a:typeinfo, 'ctagstype') let ctags_type = a:typeinfo.ctagstype @@ -1409,6 +1404,12 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort let ctags_args += ['--language-force=' . ctags_type] let ctags_args += ['--' . ctags_type . '-kinds=' . ctags_kinds] endif + + " Include extra type definitions - include last to allow for any + " overrides + if has_key(a:typeinfo, 'deffile') && filereadable(expand(a:typeinfo.deffile)) + let ctags_args += ['--options=' . expand(a:typeinfo.deffile)] + endif endif if has_key(a:typeinfo, 'ctagsbin')