1

So I am curious about one thing: when I am between two brackets ({) in vim (or nvim), and I press Enter I go from this (where the pipe sign is the cursor):

getUsers(){|}

to this:

getUsers(){
|}

How can I customize the editor to get this instead:

getUsers(){
··|
}
2
  • Well, I am not asking about just indentation. So what I am asking is, when I oppen a new bracket, vim auto closes it and puts the cursor between those brackets. When I hit enter though, I want to basically add two <CR> and put the cursor in the middle line and idented, (as I tried to mention in the question) Jun 19 '19 at 12:22
  • So from lacking from a more, lets say, elegant way, this is my solution: inoremap <C-CR> <CR><CR><Up><Tab> (And on another note, I do not know how to remove the duplicate tag, when clearly my question isn't a duplicate as statox suggested...) Jun 20 '19 at 8:30

Browse other questions tagged or ask your own question.