在vim中用空格替换制表符 [英] Replace tabs with spaces in vim
本文介绍了在vim中用空格替换制表符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 gVim 中将制表符转换为空格.我在 _vimrc
中添加了以下行:
I would like to convert tab to spaces in gVim. I added the following line to my _vimrc
:
set tabstop=2
它可以在两个空格处停止,但看起来仍然插入了一个 tab 键(我尝试使用 h 键之后计算空格).
It works to stop at two spaces but it still looks like one tab key is inserted (I tried to use the h key to count spaces afterwards).
我不知道我应该怎么做才能让 gVim 将制表符转换为空格?
I'm not sure what should I do to make gVim convert tabs to spaces?
推荐答案
IIRC,类似于:
set tabstop=2 shiftwidth=2 expandtab
应该可以解决问题.如果您已经有制表符,那么请使用一个不错的全局 RE 进行后续操作,将它们替换为双空格.
should do the trick. If you already have tabs, then follow it up with a nice global RE to replace them with double spaces.
如果您已经有要替换的标签,
If you already have tabs you want to replace,
:retab
这篇关于在vim中用空格替换制表符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文