ctags and tagbar configuration are out of sync

走远了吗. 提交于 2019-12-24 06:35:37

问题


I'm trying to use tagbar for reading code in jquery-1.7.1.js(renamed jquery.js) ,but it

doesn't work and display any errors :

"your ctags and tagbar configuration are out of sync! ".

And my ~/.ctags file:

    --regex-JavaScript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*new[ \t]+Object\(/\1/o,object/
    --regex-JavaScript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\{/\1/o,object/
    --regex-JavaScript=/([A-Za-z0-9._$()]+)[ \t]*[:=][ \t]*function[ \t]*\(/\1/f,function/
    --regex-JavaScript=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\([^\]\)]*\)/\1/f,function/
    --regex-JavaScript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*new[ \t]+Array\(/\1/a,array/
    --regex-JavaScript=/([A-Za-z0-9._$]+)[ \t]*[:=][ \t]*\[/\1/a,array/
    --regex-JavaScript=/([^= ]+)[ \t]*=[ \t]*[^""]'[^'']*/\1/s,string/
    --regex-JavaScript=/([^= ]+)[ \t]*=[ \t]*[^'']"[^""]*/\1/s,string/

回答1:


You should have read the second line of that error message, which says: "Please read ':help tagbar-extend'".

When you are defining a new language with ctags (or change an existing one) you also need to supply a corresponding Tagbar configuration so Tagbar knows that there is a new language and how to interpret ctags' output. In your case a configuration like this should work (put it into your ~/.vimrc):

let g:tagbar_type_javascript = {
    \ 'ctagstype' : 'JavaScript',
    \ 'kinds'     : [
        \ 'o:objects',
        \ 'f:functions',
        \ 'a:arrays',
        \ 's:strings'
    \ ]
\ }


来源:https://stackoverflow.com/questions/8570357/ctags-and-tagbar-configuration-are-out-of-sync

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!