我不清楚哪个选项起的作用,但我是这么设置的,而且有效。在冒号后面回车会自动缩进4个空格。set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set smarttab
set autoindent
大概是因为我在windows下用的gvim?有个behave mswin,没有深究是什么意思。source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
"键盘映射
map :!python %
map :!tcc -run %
"按F6 编译当前文件
map :!gcc % -g -o %<.exe
map :!%<.exe
map :call Run()
func Run()
exec "w"
exec "!gcc % -g -o %<.exe"
exec "!%<.exe"
endfunc
" 插入匹配括号
inoremap ( ()
inoremap [ []
inoremap { {}
inoremap < <>
inoremap " ""
inoremap ' ''
"常用配置
set nu
set nocompatible
set fileencodings=utf-8,gbk
set guifont=Courier_New:h10:cANSI
"缩进定义
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set smarttab
set autoindent
set nobackup
"用了一个插件AutoComplPop,最长补全
set completeopt=longest,menu