I find myself adding a single letter during edits. Is there any way to add a character and exit insert mode just like replacing r
but not deleting the character in Vs code vim extension?
pressing i
<character>
<Esc>
each and every time defeats the purpose of being productive.
I have also looked for mapping and tried but not sure how they work.
Any help is appreciated.
From normal mode, you can put yourself in insert mode, type a space, exit back to normal mode, then put yourself in replace mode. That way you find your cursor on a blank space in replace mode, where you can simply type the character you want to add.
Here's how to do it (replace "your-desired-mapping-here" by the mapping that you like, for example: M)
vscode vim plugin way: (add this to your settings.json)
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<your-desired-mapping-here>"],
"after": ["i", " ", "<ESC>", "r"]
}
]
vim way: (add this to your .vimrc)
nnoremap <your-desired-mapping-here> i <esc>r
note: please notice the space after i in the vim way.