# remap esc key introduced remove behave

I'v remapped esc key by double jj for insert mode and command line mode.

When I using it in command line mode it removes the word where the cursor is highlighted

cnoremap jj <esc>
nnoremap rr :s/\<<C-r><C-w>\>/


The example above shows that rr key for normal mode is highlight the current words and after user input the word and press the enter key, the highlighted words will be replaced. However, after I entered rr in normal mode and want to cancel the replace action by press jj, it removes the word under the cursor, why is that? and how can I solve this

• Tangent: maybe use * for your rr command, e.g. nnoremap rr *:s// – Peter Rincker Mar 20 '19 at 15:56