I've set up a mapping in insert mode to automatically indent brackets:
inoremap [;<CR> [<CR>];<Esc>O<Tab>
When I use it, the result looks like this (the pipe character represents the cursor):
const a = [
|
];
Now, I want a similar mapping for parentheses, so I added:
inoremap (;<CR> (<CR>);<Esc>O<Tab>
It works fine on a new buffer, but if Vim detects the .js
file type, here's how it looks:
const a = (
|
);
Is there a way to achieve this without triggering autoindent?
Just FYI, I'm using YouCompleteMe with Tern for JavaScript autocompletion.