vim /etc/vimrc
#设定tab宽度为4个字符
set softtabstop=4
#设定自动缩进为4个字符
set shiftwidth=4
#用space替代tab输入set expandtab
#设置换行自动缩进set autoindent
#不用space替代tab输入
#set noexpandtab
vim-tab键缩进4个空格
原文:https://www.cnblogs.com/zhongle21/p/12399334.html