0

我最近开始使用 vim。我:set tabstop=4在我的 .vimrc 中添加以符合缩进方案,但是当我在另一个编辑器(gedit)中打开文件时,它仍然使用 8 个制表符空格。格式看起来就在 vim 中。有什么帮助我可以解决这个问题吗?

4

3 回答 3

2

设置 tabstop 时,也值得将 softtabstop 和 shiftwidth 设置为相同的值。
我同时设置了以下所有内容(来自我的 .vimrc 文件)

" tabstop:          Width of tab character
" expandtab:        When on uses space instead of tabs
" softtabstop:      Fine tunes the amount of white space to be added
" shiftwidth        Determines the amount of whitespace to add in normal mode
set tabstop     =4
set softtabstop =4
set shiftwidth  =4
set expandtab

这是一个关于如何以及为什么的很棒的教程。
http://vimcasts.org/episodes/tabs-and-spaces/

于 2013-11-01T06:58:24.900 回答
0

对其他编辑器进行类似的更改。选项卡的宽度是编辑器的属性,而不是文件的属性。

于 2013-10-30T19:43:25.643 回答
0

您需要将选项卡“转换”为空白,以下代码可以解决您的问题。

:set expandtab

于 2013-10-30T19:46:22.630 回答