simple-javascript-indenter
simple-javascript-indenter copied to clipboard
break })
e.g.
foo({
}|)
type ,{}<left><cr>
foo({
},{
});
but should be
foo({
},{
});
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());
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.
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>
.