Window版本的gVim在默认情况下tab宽度为8个字符,习惯使用4个空格宽度作为tab来说有点别扭,可以找到gVim的安装目录下的_vimrc
文件添加如下代码即可
" size of a hard tabstop
set tabstop=4
" size of an "indent"
set shiftwidth=4
" a combination of spaces and tabs are used to simulate tab stops at a width
" other than the (hard)tabstop
set softtabstop=4
You may also want to try the following:
" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab
" always uses spaces instead of tab characters
set expandtab
以上代码来自StackOverflow,效果不错。