如何在没有可视块模式的情况下在 vim 中编辑块 [英] How to edit blocks in vim without visual block mode
本文介绍了如何在没有可视块模式的情况下在 vim 中编辑块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在不使用可视块模式选择的情况下编辑代码中的垂直块?
Is there a way to edit a vertical block in a code without using the visual block mode selection?
推荐答案
blockwise 视觉模式有什么不好?!没有其他实用的替代方法.
What's so bad about blockwise visual mode?! There's no practical alternative to it.
- 您可以将
:substitute
与\%>v
、\%<v
、\%> 等原子一起使用;l
和\%
将模式匹配限制为矩形块,但这非常繁琐. - 有一些多编辑插件(受其他编辑器的启发)允许您选择一些区域,然后同时编辑它们.
- 出于特殊目的,您可以使用
getline()
/setline()
和 Vimscript 中的字符串操作编写脚本/映射.
- You could use
:substitute
with atoms like\%>v
,\%<v
,\%>l
and\%<l
to limit the pattern match to a rectangular block, but that's very tedious. - There are some multi-edit plugins (inspired by other editors) that allow you to select some areas, and then simultaneously edit them all.
- For special purposes, you could write a scriptlet / mapping with
getline()
/setline()
and String manipulation in Vimscript.
这篇关于如何在没有可视块模式的情况下在 vim 中编辑块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文