在 VIM 中编辑 HTML 时跳转到 CSS 定义 [英] Jump to CSS definition when editing HTML in VIM

查看:36
本文介绍了在 VIM 中编辑 HTML 时跳转到 CSS 定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我正在 VIM 中编辑 index.html 或 index.php,其中有以下代码:

当我将光标移动到单词 header 时,我想跳转到 CSS 文件中定义标签 (id/class) 的位置.ctags 不适用于此.谢谢你的建议!

解决方案

您可以尝试修补 ctags 以使其支持 CSS.这个人解释了如何但我不知道它是否有效.我可能很快就会尝试这个解决方案,因为我认为这个功能会很糟糕.

另外,我应该补充一点,我没有从我的魔法书签帽中提取这篇旧博客文章.这是一个非常简单的谷歌查询的第一个结果,在问这里之前你环顾四周了吗?而且,如果你做了,你发现/尝试了什么?

另见那里那里.

编辑

此解决方案不需要打补丁/编译并且运行良好.

For example I am editing index.html or index.php in VIM and I have the following code in there:

<div id="header">

// some code

</div>

When I move my cursor to the word header I want to jump to the position in my CSS-file where the tag (id/class) is defined. ctags doesnt work with this. Thx for advise!

解决方案

You could try to patch ctags so that it supports CSS. This guy explains how but I have no idea if it works or not. I'll probably give this solution a try very soon as I think this feature would kick ass.

Also, I should add that I didn't pull this old blog post from my magic bookmarks hat. It was one of the first results of a very simple Google query, did you look around before asking here? And, if you did, what did you found/try?

See also there and there.

edit

This solution doesn't require patching/compiling and works very well.

这篇关于在 VIM 中编辑 HTML 时跳转到 CSS 定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆