VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.73k stars 1.31k forks source link

sub-replace-expression (:s/.../\=...) #8910

Open dhnam opened 6 months ago

dhnam commented 6 months ago

Is your feature request related to a problem? Please describe. I was looking for easy way to multiply number, and found out there's a way - using expression in substitute (:s).

For example, :s/\d\+/\=submatch(0)*5/ is valid command in vim - it multiplies number by five.

But it doesn't work in vsvim.

Describe the solution you'd like It is feature supported in normal Vim, as written in vimhelp.

So implementing this could be solution.

Additional context There was an issue about expression (https://github.com/VSCodeVim/Vim/issues/4383). It was not about expression in replace, but it was about expression register.

J-Fields commented 2 months ago

Most of what's needed for this is in https://github.com/VSCodeVim/Vim/pull/7920. I'll try to revive that PR soon.