2010-08-24 39 views
2

我用Vim中的python關鍵字使用這個命令做自動縮進後續行。Python的Vim「smartoutdent」?

autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,... 

有沒有辦法爲關鍵字(如return或break)做一個「smartoutdent」?

謝謝。

回答

2

我用:

filetype indent on 
filetype plugin indent on 
set autoindent 

,並聲明如returnbreakcontinue後自動備份縮進。

我不確定是否有必要,或者是否符合您的「smartoutdent」的要求,但也許會有所幫助。

+1

第一行不是必需的。第二行也會打開'filetype indent'。如果您使用的是文件類型縮進,您也不使用自動縮進。總結:只使用第二行,你會對'vim'知道的所有文件類型有好處。 – Cascabel 2010-08-24 15:59:56