我想知道是否有人知道一个Vim插件可以处理HTML或XML文件(最好是两者)上的父/子/兄弟元素之间的光标移动.
seh*_*ehe 16
我喜欢使用默认移动和(可视)文本对象
vatatzc # create a fold for second parent tag with all child elements
yit6jvitp # yank this element child nodes and, 6 lines down,
# replace the element content with the yanked text
Run Code Online (Sandbox Code Playgroud)
Matchit.vim会做你想要的一些事情.当您按下%键时,它会在打开和关闭XML/HTML标记之间跳转.但是有一些标签会增加一种特殊的行为.例如,如果光标位于<ul>标签上,按下%会将光标向前移动到下一个<li>标签,依此类推,直到到达结束</ul>标签,然后%跳转到开始标签.
Matchit与Vim一起发布,因此您无需安装它.但是你必须通过将它放在你的vimrc文件中来启用它:
runtime macros/matchit.vim
Run Code Online (Sandbox Code Playgroud)