键入javascript对象文字时,例如:
foo = {
bar: baz
};
vim认为“ bar:”是C样式的标签,并将其移至列0.
如何停止呢?
解决方法:
尝试:set cinkeys- =:.
标签缩进不能由cinoptions控制.引用:help indent
如果出现以下情况,Vim将在第1列中放置一行:
- It starts with ‘#’ (preprocessor directives), if ‘cinkeys’ contains ‘#’.
- It starts with a label (a keyword followed by ‘:’, other than “case” and
“default”).- Any combination of indentations causes the line to have less than 0
indentation.
(强调我的)
但是,cinkey指定在插入模式下哪些键触发重新缩进.通过从cinkeys中删除:,vim将不再重新插入:.
但是请注意,通过=手动重新缩进仍然会破坏您的布局.