In this clip,
- From visual mode here after selecting
im.g.matI trigger my
vnoremap <m-/> y:%s/<c-r>0//g<left><left>bind.
- The purpose of this bind is to initiate a global file replacement search and replace via
<left><left>in the map leaves the cursor in the spot to begin typing the replacement.
- It really works and neovim here is a baller and displays the result in realtime as I type. I type
replacement is cool. This works because a
.in a regex happens to match
.. Then I hit Esc to cancel.
- I go ahead and try it again but this time on a section of this above vnoremap definition, with predictable failure due to the robustness issue hinted at in this page: https://vim.fandom.com/wiki/Search_for_visually_selected_text
I have an old crufty vimL config that has something built off of this. I would like to replicate it again today with my new lua config but I'm not sure where to start. I'd really like to avoid all of the insane stuff that is employed in this approach. I would be down for coding this up in lua if it can be done in a straightforward way.
Mostly looking for any clever ideas here. Because actually a regex replacement is too powerful for the typical usecase. Since it's created this problem of having to do this complex transform on the input string to remove special regex chars from it, and if we could convince neovim to do the same functionality but only for plain text replacement I'd be off to the races.