martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 260 forks source link

literal modifier for regex selections #1159

Open lanodan opened 6 months ago

lanodan commented 6 months ago

Selecting code containing a lot of braces via is quite a chore and can lead to mistakes if you're not careful.
I think a modifier should exists for literal (non-regex) matches, for example having l as this modifier you could avoid x/\[\$\{FOO\}\]/ … and simply have x/[${FOO}]/l ….

By the way for ones wanting a simple selection of existing text, there is C-a in visual mode, but it has the limitation of not being chainable like commands are (for example if you only want to change [${FOO}] in an already selected function-block).

ninewise commented 5 months ago

Being able to match literal strings would be nice to have. I'd not use a modifier like suggested, though, because the vis command line syntax currently does not have the concept of modifiers at all. I'm not sure what syntax would be better though, regex(7) does not support longer literals matches.