javascript - ctags, jsctagsdoctorjs, Tagbar step by step - Stack Overflow

I need help on setting up ctags, jsctags, and tagbar so I can have a workable Javascript editing envrio

I need help on setting up ctags, jsctags, and tagbar so I can have a workable Javascript editing envrionment. I got everything installed but couldn't get an idea how ctags and jsctags work together so I don't know how to configure properly. I have done quite a bit Google around but the information is pretty broken and lacks consistency. I got an error similar to this post, ctags and tagbar configuration are out of sync. I'm on OS X mountain lion and iterm2.

Any help would be greatly appreciated. A step by step instructions would be excellent.

Thx.

I need help on setting up ctags, jsctags, and tagbar so I can have a workable Javascript editing envrionment. I got everything installed but couldn't get an idea how ctags and jsctags work together so I don't know how to configure properly. I have done quite a bit Google around but the information is pretty broken and lacks consistency. I got an error similar to this post, ctags and tagbar configuration are out of sync. I'm on OS X mountain lion and iterm2.

Any help would be greatly appreciated. A step by step instructions would be excellent.

Thx.

Share Improve this question edited May 23, 2017 at 12:23 CommunityBot 11 silver badge asked Mar 15, 2013 at 6:01 1001b1001b 2653 silver badges13 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

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 plain 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 pletely separate:

  • Use TagBar to understand/navigate in your current buffer.

  • Use Vim's tag-related functionalities to move around your project.


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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745366085a4624584.html

相关推荐

  • javascript - ctags, jsctagsdoctorjs, Tagbar step by step - Stack Overflow

    I need help on setting up ctags, jsctags, and tagbar so I can have a workable Javascript editing envrio

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信