VSCodeVim / VSCodeVim/Vim

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

Open
#8,910 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/commandline kind/feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.