Hot For Coding

vim编辑器tab设置4个字符

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,效果不错。

分享

TITLE: vim编辑器tab设置4个字符

LINK: https://www.qttc.net/409-vim-tab-size-4.html

NOTE: 原创内容,转载请注明出自琼台博客