I would do:
inoremap <Tab> <Esc>/[\])}$]<CR>a
This mapping:
- Switch to Normal mode
<Esc>
- Search for a closing brace (
)
,}
,]
) or a$
/[\])}$]
- Switch back to insert mode
a
But it is not exactly the same of going one level up in nesting.
If you activate the builtin matchit
plugin (runtime macros/matchit.vim
) you could do:
imap <Tab> <Esc>]%a
It uses the ]%
which is the equivalent of ])
but for all the 'braces' considered by matchit.
Remark: It doesn't support $
because for $
the open and closing brace characters are the same which make determining the level of nesting much more complex.