break }) #8

Open
guileen opened this Issue Nov 12, 2011 · 3 comments

Projects

None yet

2 participants

@guileen
Contributor
guileen commented Nov 12, 2011

e.g.

foo({
}|)

type ,{}<left><cr>

foo({
},{
});

but should be

foo({
  },{
});
@jiangmiao
Owner

I've made it indent as more as possible in 1.4.3, so it should be a feature for me
just add a global option g:SimpleJsIndenter_GreedyIndent
set it to 0 to make }, { does't indent.

The line starts with '} else' will still be indented. related condition in source: s:IsOneLineIndentLoose(pline)

if () {
} else {
}

The line doesn't contains any isolated [({ will still be indented as more as possible. related condition in source: pline !~ s:expr_left

foo({
}, b());
@guileen
Contributor
guileen commented Nov 14, 2011

I have try it, but I think it's not the problem of indent rule, the old rule is right, the problem happens at <cr> pressed, if I type == at the line of },{, it will be what it should be.

@jiangmiao
Owner

sorry, just understood, you are using Normal Mode instead of Brief Mode and the previous line won't reindent after entering <CR>, I have no idea how to solve the issue by adding rule to indentkeys. Here is another solution is imap the <CR>

inoremap <CR> <CR>.<ESC>k==jI<DEL>

or try my another plugin auto-pairs which already map the <CR>
but there is an annoy thing currently, the cursor will flash at previous line when press <CR>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment