Emacs, Evil-Mode: replace only with visual selection / visual block?

By default, it :s/[search-term]/[replace-term]works on whole lines, not on visual selection. For example, if you choose between c and e, as such:

a b |c d e| f g

and do :s/ //g, the result:

abcdefg

but not

a b cde f g

Similarly, when choosing a visual block:

a b |c d e| f g
0 1 |2 3 4| 5 6

:s/ //g gives

abcdefg
0123456

but not

a b cde f g
0 1 234 5 6

Does anyone have a way to make evil mode :s/work only with a choice (preferably by default or, alternatively, with a keyword like vim \%V)?

( :s/\%V //gdoesn't seem to work in this case, this leads to 0 matches.)

Thanks in advance.

+4
source share
1 answer

, . '<,'> , `<,`> . ,

a b |c d e| f g`, 

:`<,`>s/ //g

a b cde f g

, Evil, , Visual Block, .

+6

All Articles