我正在尝试学习vim :-)有一些真正的麻烦与自动缩进改变我的Python代码的含义。有没有办法获得autoindent的好处,而不会遇到像下面那样的行为?Vim Python缩进更改代码语义
我开始一个python的文件:
[email protected]:/tmp$ cat pytest.py if False: print('Never', 'print this line') print 'Always print this line.'
自动缩进与vim pytest.py
,gg=G
,:wq
D'哦,我搞砸了我的脚本:
[email protected]:/tmp$ cat pytest.py if False: print('Never', 'print this line') print 'Always print this line.'
试图保持这真的是香草:
[email protected]:/tmp$ cat ~/.vimrc filetype plugin on filetype indent on autocmd FileType python set sw=4 autocmd FileType python set ts=4 autocmd FileType python set sts=4 autocmd FileType python set textwidth=79
这就是为什么我从不使用自动压缩器的原因,即使在使用缩进不重要的语言编写时也是如此。我建议在编写代码时保持清洁,避免任何类型的自动操作。 – redShadow 2011-12-14 02:03:55