Skip to content

Conversation

@jhradilek
Copy link

This is an attempt to resolve #789 and re-enable support for addition of a new language definition from within vim configuration without having to edit ~/.ctags.

With this patch, if you need to define a language that is unknown to ctags and provide a custom file with deffile as documented in doc/tagbar.txt, you can use deflang as follows:

let g:tagbar_type_asciidoc = {
  \ 'ctagstype': 'asciidoc',
  \ 'deflang': 'asciidoc',
  \ 'deffile': expand('<sfile>:p:h:h') . '/ctags/asciidoc.cnf',
  \ 'sort': 0,
  \ 'kinds': [
    \ 's:Table of Contents',
    \ 'i:Included Files',
    \ 'I:Images',
    \ 'v:Videos',
    \ 'a:Set Attributes',
    \ 'A:Unset Attributes'
  \ ]
\}

@jhradilek
Copy link
Author

On the off chance this solution gets approved, I'd be of course happy to update docs/tagbar.txt as well.

Comment on lines +1402 to +1404
if has_key(a:typeinfo, 'deflang')
let ctags_args += ['--langdef=' . expand(a:typeinfo.deflang)]
endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to just key off the deffile instead. Then there wouldn't need to be any new config keys. Can you give this a try and see if this works?

Suggested change
if has_key(a:typeinfo, 'deflang')
let ctags_args += ['--langdef=' . expand(a:typeinfo.deflang)]
endif
if has_key(a:typeinfo, 'deffile')
let ctags_args += ['--langdef=' . a:typeinfo.ctagstype]
endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#777 breaks the ability to add a definition for a new language or file type

2 participants