sub-replace-expression (:s/.../\=...)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the :s substitute command handling and compare its replacement behavior with Vim's change.txt#sub-replace-expression documentation. Use the example involving submatch(0)*5 as the expected behavior, and review issue #4383 for related expression-register context. Done means the documented expression replacement works in VSCodeVim.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100