In normal mode to open the Find-Replace window with the word under cursor
map <leader>f :promptrepl <c-r><c-a><cr>
Now, I want something similar but with the visual selection instead of the word under the cursor, like
vmap <leader>f <y><Esc>:promptrepl <c-r>0<cr>
but this gives me the error E73: tag stack empty
Any advise appreciated
You’re doing it correctly, except that you have an extra pair of
< >in your map.I’m not sure if there is another way to retrieve the visually selected text. Of course, you could append a register to your yank, one that’s rarely used for you (say
"ny), so you don’t mess with your register0. Then change the<c-r>0to<c-r>n.