Right now I press
ce to replace a word. However, this overrides anything that was in my register before. How can I replace a word and go into insert mode after without replacing what was in my register previously?
You need to use the black hole register (see
When writing to this register, nothing happens. This can be used to delete text without affecting the normal registers. When reading from this register, nothing is returned.
"_ce so that the deleted text will be put into the black hole register and not into your unnamed register.
@statox is spot on with the Black hole register.
In fact I use this so much I remapped to my
x key in my .vimrc file:
noremap x "_x This allows me to visual select then
x it away while maintaining my last yanked text.
If you want to swap text from one place to another check out tommcdo/vim-exchange.