在 VIM 中使用 VISUAL MODE 替换 HTML 标签
所以我可以替换“<” -VIM 中的方括号使用 ":s/
如何替换 VISUAL MODE 中标记的所有方括号?假设我想将所有标记的括号 " 替换
为屏幕截图中的 "<",因此它将在 HTML 中显示为代码 我只想替换它们,而不是其他的,你知道什么是 抱歉初学者的问题
,但我很想知道。
很
so I can replace "<" -square brackets in VIM using ":s/</</g" and thats great, but It does not replace the ending bracket, thats problem number one. But the main issue is:
How do I replace all square brackets marked in VISUAL MODE? Say I want to replace all marked brackets "
just as on the screenshot with "<", so It will be displayed in HTML as code. I want to replace only them, not the others, do you know what is the pattern?
Sorry for beginners question, but I would like to know.
Thank you so much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
:s/ 没有任何用处。您的意思是
:s/ 吗?
:s/</</g
does nothing useful. Did you mean:s/</\</g
?如果我正确解释了您的问题和屏幕截图,您希望用红色标记的
>
替换为>
- 是吗?如果是这样,那么我认为 @romainl 提出了一个很好的答案::s/>/>/g
If I correctly interpret your question and screenshot, you want the
>
marked in red to be replaced with>
-- yes? If so, then I think @romainl suggested a good answer::s/>/>/g
:s/&gt;/&gt;/g工作正常,谢谢。
基本上,我还想知道我是否可以为多行进行此操作。您需要做的就是选择或标记特定的“角括号”,因此,要归功于Romainnl和M_MLVX。
:s/>/>/g is working fine, thank you.
Basically, I also wanted to know if I can do this for multiple lines. Bat all you need to do is to select or mark specific "angle brackets", so again, thanks to romainnl and m_mlvx.