Vim";smartoutdent“;对于Python?

Vim";smartoutdent“;对于Python?,vim,Vim,我使用这个命令在Vim中使用以python关键字开头的自动缩进跟随行 autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,... 有没有办法对return或break等关键词进行“smartoutdent” 谢谢。我使用: filetype indent on filetype plugin indent on set autoindent 并且它会在语句后自动缩进,例如return、break和continue 我

我使用这个命令在Vim中使用以python关键字开头的自动缩进跟随行

autocmd BufRead *.py  set smartindent cinwords=if,elif,else,for,...
有没有办法对return或break等关键词进行“smartoutdent”

谢谢。

我使用:

filetype indent on
filetype plugin indent on
set autoindent
并且它会在语句后自动缩进,例如
return
break
continue


我不确定是否所有这些都是必需的,或者它是否满足您对“smartoutdent”的要求,但也许它会有所帮助。

第一行不是必需的。第二行也打开了
文件类型缩进。如果您使用的是文件类型缩进,那么您也不会使用自动缩进。小结:只使用第二行,您将适用于vim所知道的所有文件类型。