First, you have to understand that jsctags and ctags will probably never be in sync. Even if you have only a simple function, both programs may output slightly different informations. Thus it is advised to use one or the other but not both.
Second, AFAIK, TagBar doesn't need to be configured to use jsctags instead of ctags. If you are doing JavaScript it will simply default to jsctags if it's available. TagBar shouldn't complain if you have a working jsctags.
Third, for its own tag-related functionalities (:tag
, :tselect
, <C-]>
, etc.), Vim only relies on the presence of one or more physical tags
files. Whether those files are generated by ctags, jsctags or whatevertags is not a concern as long as they are generated correctly.
And now we arrive at the fourth point which is where the pain really is: neither Tagbar nor its older cousin TagList actually use a physical tags
file. They tap ctags or jsctags directly without even trying to use or update any existing tags
file. Because of that, and the fact that TagBar only deals with the current buffer, your own physical tags
file (and thus Vim's tag-related functionalities) and TagBar are almost guaranteed to be out of sync. Even if you use the same indexer.
So… I'd advise you to use either ctags or jsctags and forget anything about syncing TagBar's and Vim's tags-related stuff as both things are completely separate:
Random thoughts…
For Vim to locate your tags
file(s) easily, you should put this line in your ~/.vimrc
:
set tags=./tags,tags;/
./tags
means "look for a tags
file in the directory of the current file", tags
means "look for a tags
file in the working directory", ;/
means "keep looking up and up until you reach /
".
The TagBar wiki talks about a bug in jsctags, make sure that you are not concerned by it.
jsctags is better than ctags when you write crazy "modern" JavaScript with lots of callbacks and self-executing functions. If your JavaScript is more traditional, ctags may be enough.