考虑以下代码块-
if (1==1):#Go forever
print "Wooo."
由于注释,Vim 看不到 :, 所以它坚持打印应该与 "if"处于相同的缩进级别
使用 http://www.vim.org/scripts/script.php?script_id=974
如有任何想法,我们将不胜感激。
请您参考如下方法:
在 .vim 文件中找到这个:
" If the previous line ended with a colon, indent relative to
" statement start.
if pline =~ ':\s*$'
将其更改为...
" If the previous line ended with a colon, indent relative to
" statement start.
if pline =~ ':\s*\(#.*\)\?$'
这将使它也匹配以冒号结尾且后跟注释的行。
