Objective-c 的 Ctags/Cscope 替代品?
是否有任何具有 Objective-c 支持的 ctags 和 cscope 替代品?这确实与可可开发有关,所以我似乎不可避免地会使用 Xcode(并且可能应该)。我只是想知道我的 Vim 有哪些选择。
也许有某种类型的插件系统,例如 eclim,但是对于 xcode 来说?
编辑
所以看来除了更新 ctags 以支持 Objective-c 之外,我运气不好。有谁知道 cscope 是否相同?
Are there any alternatives to ctags and cscope with Objective-c support. This does pertain to cocoa development, so inevitably it seems I will be using Xcode (and probably should). I was just wondering what are my Vim options.
Maybe there is some type of plugin system like eclim, but for xcode?
EDIT
So it seems that other than updating ctags to support objective-c, I'm out of luck. Does anyone know if cscope is the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
在这个问题出现很长一段时间后,用 vim“玩”,我想要 ObjC 支持,尤其是 taglist 插件。我发现了这个问题,然后挖掘了一下,这是一个不太脏的解决方案:
您可以通过自制程序轻松将其安装在 OSX 上:
$brew install ctags --HEAD
请注意使用 ctags 时,
.m
被视为 Matlab,.h
被视为 C++。要覆盖,请使用:$ ctags --langmap=ObjectiveC:.mh
然后我将类似的内容添加到我的
.vimrc
中以获得标签列表支持:let tlist_objc_settings = 'ObjectiveC;P:协议;i:接口;类型(...)'
从该列表中添加您感兴趣的任何类型:
我希望这会对某人有所帮助!
a long time after this question, "playing" with vim, I wanted ObjC support, especially with taglist plugin. I found that question, then digged a bit, and here is a not so dirty solution:
You can easily install it on OSX via homebrew:
$ brew install ctags --HEAD
Note that when using ctags,
.m
is treated as Matlab and.h
is treated as C++. To override, use:$ ctags --langmap=ObjectiveC:.m.h
Then I added something like this to my
.vimrc
for taglist support:let tlist_objc_settings = 'ObjectiveC;P:protocols;i:interfaces;types(...)'
add any type interests you from that list:
I hope that will help someone!
Universal-ctags(https://ctags.io) 可以捕获 Objective-C 的属性。
Universal-ctags(https://ctags.io) can capture properties of Objective-C.
AFAIK,ctags 支持您为新语言定义一些规则,我在使用 laszlo(类似于 flex)进行一些开发时就这样做了。您可以阅读 ctags 的联机帮助页以获取更多详细信息,这并不难做到。
我发现有一个支持在cocoa下开发的vim文件类型插件 这里 ,希望对您有帮助。
AFAIK, ctags support you to define some rules for a new language, I did that when I did some development using laszlo(similiar to flex). You can read the manpage of ctags to get more details, that is not hard to do.
I find there is a vim filetype plugin that support development under cocoa here, hope it is helpful for you.
可以选择将 ctags 用于 Objective-C。您可以在 ctags 模式下使用 etags。 etags是前段时间从ctags衍生出来的,在它的源码中会通过定义一定的宏开关来生成ctags兼容的标签。
事实上,Mac OS 中的手册页已经在同一页面中记录了 etag 和 ctag。它指出 ctags 支持 Objective-C。您应该能够使用以下命令生成标记文件:
ctags -l objc *.[mh]
不幸的是,Mac OS 中的 ctags 程序的行为并不像记录的那样,因为 Apple 搞砸了。然而,我成功地使用 Ubuntu Linux 安装了这种 ctags,并且效果很好!您必须在那里安装 emacs22-bin-common 软件包。
所以在 Mac OS 下你所要做的就是自己编译这个包。
你就完成了。快乐标记!
There is an option to use ctags for objective-c. You can use etags in ctags mode. etags derived from ctags some time ago, and in its source code ctags compatible tags will be generated by defining a certain macro switch.
In fact the man page in Mac Os already documents etags and ctags in the same page. It states that objective-c is supported in ctags. You should be able to generate a tag file using the following command:
ctags -l objc *.[mh]
Unfortunately the ctags program in Mac OS behaves not as documented since Apple messed it up. I however managed to install this kind of ctags using Ubuntu Linux and it works great!!! There you have to install the emacs22-bin-common package.
So under Mac OS all you have to do is to compile this package for yourself.
You are done. Happy tagging!!!
你也可以试试我写的objcscope。
objcsope
You can also try objcscope which is written by me.
objcsope
关于另一个答案:您可以相当轻松地使用 MacPorts 安装 EMACS,它将在 /opt/local/bin 中包含一个 etags 版本,其中编译了 Objective-C 支持。
然后在 vim 中:
这对我使用 MacVim 来说效果很好。
Apropos the other answer: you can install EMACS with MacPorts fairly easily and it will include a version of etags at /opt/local/bin that has Objective-C support compiled in.
And then inside vim:
This works well for me with MacVim.
您可以尝试 Exuberant Ctags 的 Fishman 分支,它支持 Objective C 和 CSS。
You can try Fishman fork of Exuberant Ctags which has Objective C and CSS support.
我发现让 ctags 为 tagbar 生成标签很困难。使用 Objective-C 编辑器的 vim 插件更容易。 XVim 可与 XCode 配合使用。如果你像我一样使用 Appcode,IdeaVim 集成得很好。
尽管您无法使用该插件获得完整的 Vi/Vim 功能。我发现与本机 IDE 命令的混合使用足以弥补这一不足。
I found it difficult getting ctags to generate tags for tagbar. It was easier to use a vim plugin for the Objective-C editor. XVim works with XCode. If you use Appcode like me, IdeaVim is well integrated.
Though you won't get to full Vi/Vim functionality with the plugin. I find mix usage with native IDE commands is enough to compensate.
如果我没记错的话:
我必须重新编译 ctags (https://sourceforge.net/p/ctags/code /HEAD/tree/)通过注释
ObjC.c
中的所有属性关键字处理作为解决方法。尽管如此,它只会有助于更好地阅读 Taglist 中的源代码。它仍然无法跳转(例如到实现
带参数的方法)正确。
我也尝试过这个(https://github.com/mcormier/ctags-ObjC-5.8 .1),但不幸的是这根本无法跳转。
总结: ObjC 似乎没有像 C/C++ 那样可行的 ctag。
If I am not wrong :
I have to recompile ctags (https://sourceforge.net/p/ctags/code/HEAD/tree/) by commenting all of the property keyword processing in
ObjC.c
as a workaround. Even though, it only helps to get a little better for reading source code in the Taglist.It still can't jump (e.g. to the implementation
methods with parameters) correctly.
I also tried this(https://github.com/mcormier/ctags-ObjC-5.8.1), but unfortunately this can't jump at all.
Summary : there seems no ctags for ObjC as workable as for C/C++.