系统:ubuntu 14.04.2
我用vim7.4写python代码,有时候想插入一个'#'(注释),然后vim把这个'#'放到行首。 可能我没有解释清楚。 例子: 代码:
if 'test' == 'abc':
print 'something'
我想在第二行插入一个'#'。然后会发生这种情况:
if 'test' == 'abc':
# print 'something'
这是自动发生的。
但是我想做的就是这样:
if 'test' == 'abc':
# print 'something'
请您参考如下方法:
散列字符 # 的缩进有问题:http://vim.wikia.com/wiki/Restoring_indent_after_typing_hash
Q: Why does Vim place # at the first column?
A: You are using 'smartindent', or you have 0# in your 'cinkeys' or 'indentkeys' options.
Under some circumstances, when you type a '#' character while in insert mode, the indent on the current line will be removed. Also, formatting or otherwise attempting to adjust the indent of a line starting with '#' may not work as you expect.
This tip discusses the issues and how problems can be avoided.
