I use vim with ruby. I have a habit of opening and closing brackets when I define new function or a block.
For example I would type:
array.map {}_ # _ - cursor position after finishing typing
So I am still in Insert mode I have a mapping imap jk <esc>
to get me out to normal mode. Cursor is going back under the closing bracket and I can press i to start typing inside the brackets.
My question is how would I go around creating the mapping <leader>i
that would insert spaces automatically on both sides of the cursor?
array.map {}_ # jk<leader>i
array.map { _ }