我在这里找到了答案http://vim.wikia.com/wiki/Restoring_indent_after_typing_hash
看来vim smartindent选项是造成此问题的原因。上面引用的页面描述了工作循环,但是在阅读了vim本身中的smartindent帮助(:help
smartindent)之后,我决定尝试使用cindent而不是smartindent。
我更换了
set smartindent
与
set cindent
在我的.vimrc文件中
到目前为止,它运行良好。
此更改还修复了缩进包含Python注释的可视块时’<<’和’>>’的行为。
vim帮助中有关smartindent和cindent的缩进有更多配置选项和有关信息(:help smartindent和:help cindent)。



