preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.1k stars 485 forks source link

Allow addition of new language types (#789) #792

Open jhradilek opened 2 years ago

jhradilek commented 2 years ago

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 commented 2 years ago

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