5

Whenever I type a : (colon) it moves all the text on the current line to the beginning of the line, ignoring spaces and tabs.

So if I type

var combo = new Ext.form.ComboBox({
  typeAhead //I'm about to type a colon, but right now it looks fine
})

Then I type the colon it moves the text and it now looks like

var combo = new Ext.form.ComboBox({
typeAhead: //text is no longer indented
})

This is a javascript file, so that might be causing the problem?

How can I stop my text from being moved to the beginning of the line when I type a colon?

4

1 回答 1

8

在标记的末尾添加冒号会导致 vim 将其解释为用于 C 缩进目的的跳转标签。 :set cino+=L0应该使它留在当前列中。

此外,JSON 语法不允许您引用冒号之前的内容吗?这应该可以防止 vim 认为它也是一个标签。

var combo = new Ext.form.ComboBox({
    "typeAhead": "foo"  // this isn't a jump label
});
于 2013-07-24T15:36:51.173 回答