VIM:为什么替换选项卡与插入模式选项卡不同
我有一个很大的空格缩进文件。我通过以下方式用制表符替换了空格:
:%s/ /<Ctrl-Tab>/g
但是,当我 set list
时,我看到替换制表符给出字符 ^T
而不是我配置的 .___< /code> (来自
set listchars=tab:._,trail:.
)。事实上,如果我在插入模式下插入一个选项卡,那么它确实会显示正确的 .___
,所以显然这两个字符是不同的。
如何使用 :s
插入“普通”选项卡?谢谢。
I have a large space-indented file. I replaced the spaces with tabs by way of:
:%s/ /<Ctrl-Tab>/g
However, when I set list
I see that the replacement tabs give character ^T
instead of my configured .___
( fromset listchars=tab:._,trail:.
). In fact, if I insert a tab in Insert mode then it does show the proper .___
, so obviously the two characters are different.
How can I insert a "normal" tab with :s
? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在表达式中使用“\t”:
此外,您可能希望使用
:retab
替换文件中的空格和制表符,通过设置,例如:Use "\t" in the expression:
Also, you may want to replace spaces with tabs in the file with
:retab
, by setting, eg: