how to stop vim moving javascript object keys to column 0 -
when typing javascript object literals, such as:
foo = { bar: baz };
vim thinks "bar:" c-style label , moves column 0.
how stop this?
try :set cinkeys-=:
.
label indentation cannot controlled cinoptions
. quote :help indent
vim puts line in column 1 if:
- it starts '#' (preprocessor directives), if 'cinkeys' contains '#'.
- it starts label (a keyword followed ':', other "case" , "default").
- any combination of indentations causes line have less 0 indentation.
(emphasis mine)
however, cinkeys
specifies keys trigger reindenting in insert mode. removing :
cinkeys
, vim no longer reindent on inserting :
.
but aware manual re-indenting via =
will still break layout.
Comments
Post a Comment