Open socketbox opened 3 years ago
Is your feature request about something that is currently impossible or hard to do? Please describe the problem. It is not possible to configure vim's default behavior regarding substitution within a visual selection.
What about this approach?
func! VisualSearch()
if getcmdline() =~ "^'<,'>s$"
return "/\\%V"
else
return "/"
endif
endfunc
cnoremap <expr> / VisualSearch()
Yeah, this is a long term desire. It's not so easy to implement in a generic and backwards compatible way.
Thank you both for your replies. I'd be grateful were you to keep this request open and in mind when/if the relevant code is refactored.
Is your feature request about something that is currently impossible or hard to do? Please describe the problem. It is not possible to configure vim's default behavior regarding substitution within a visual selection.
Describe the solution you'd like I would like to configure vim such that, by default, and without any special characters in the substitution string, it replaces text only within the visual selection.
Describe alternatives you've considered Installing a third-party plugin, which is complete overkill to get the application to behave intuitively by default.
Additional context If I select text in visual mode, that means the selection is significant for any subsequent operation--otherwise, why would I have gone to the trouble of selecting it? Why should I then be required to further indicate that what I want to do (to wit, substitute one string for another) relates to the already selected text by using
\%V
(I've got to type that twice on either side of the string I want substituted within the visual selection). Why is the use of redundant operators the default behavior?