Hi, Vim uses cindent for JS files which works in general nicely. There are a few cases where this does not work correctly. F.e.
var a = {
b: 1,
c: "hello"
}
cindent would align b: 1 to col 0 and indent c: "hello" by shiftwidth.
This is because of how it treats labels in C. The attached fix avoids
this by using another 'cindentoption' value 'J' so that such lines
could be treated differently if the file is a JS file. This also sets
the 'j' option used by Java files in order to handle anonymous
functions in JS. Further it changes how a 'case' label is determined,
to suit JS also.
I've tested this fix with JS & C source code and it seems working for me.
Review is appreciated,
/harig
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
vim-jsindent.diff
Description: Binary data
