ctags and tagbar configuration are out of sync
Asked Answered
S

1

1

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/
Surfacetosurface answered 20/12, 2011 at 3:14 Comment(0)
I
4

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'
    \ ]
\ }
Isolationist answered 20/12, 2011 at 4:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.