我不清楚哪個選項起的作用,但我是這麼設定的,而且有效。在冒号後面回車會自動縮進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