使用 Vim 和 ctags 导航大型 HTML 文件
是否可以使用 ctags (5.8) 为单个大型 HTML 文件(约 50 MB)生成标签文件,以便在 Vim 中更轻松地导航?
Is it possible to generate a tag file with ctags (5.8) for a single, large HTML file (about 50 MB) so it can be easier navigated within Vim?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您发出以下命令,您将看到为给定语言生成了哪些标签。
如果这些标签不够好,总是可以使用 RegEx 添加更多标签。
http://ctags.sourceforge.net/EXTENDING.html
If you issue the following command you will see what tags are produced for a given language.
If those tags were not good enough there is always the possibility to add to more with RegEx.
http://ctags.sourceforge.net/EXTENDING.html
如果您想导航到标签名称(如评论中所述),那么我认为简单的搜索效果会更好。您注册了每次出现的
、
等的索引将比索引文件本身大得多。
要查找标签(例如
),只需尝试 /<p< /kbd>\>
序列 \> 匹配“结束”例如,它不会匹配
如果您想导航到某个 ID,您只需按星号 * - 这将找到光标下下一个出现的单词。
If you want to navigate to tag names (as said in the comment), then I suppose that simple search would work better. An index where you have registered every occurrence of
<p>
,<span>
and so on, would be much larger that the indexed file itself.To find a tag (for example
<p class="x">
), just try /<p\>The sequence \> matches an "end of the word", so it will not match
<pre>
for example.If you want to navigate to an ID, you may just press an asterisk * - this will find you the next occurrence of the word under cursor.
作为没有 ctags 的解决方法,我尝试了这个插件 Quick-Filter。这对我有用。
我想使用 ctags 的解决方案也会很好。
As a workaround without ctags I tried this plugin Quick-Filter. It works for me.
I imagine a solution with ctags would be nice, too.