VSCodeVim / VSCodeVim/Vim

Support for `:sg` command

Open
#6,126 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/commandline kind/enhancement
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
In vi/vim, if you want to repeat the last :s/text/replacedtext/g command you can just type :sg. This doesn't seem to work in VSCode. :s does, but it only replace the first occurrence in the line.

To Reproduce
Steps to reproduce the behavior:

  1. Create a text file with these two lines
REPLACEME REPLACEME
REPLACEME REPLACEME
  1. Execute :s/REPLACEME/REPLACED/g on first line, verify that both occurrences are replaced
  2. Execute :sg on second line

Observed behavior
Error E492: Not an editor command: sg

Expected behavior
The second line show change to contain

REPLACED REPLACED

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

Environment (please complete the following information):

Extension (VsCodeVim) version: 1.18.9
VSCode version: 1.53.1
OS: MacOS 11.2

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

Reproduce the issue in VSCodeVim using the documented two-line text and the :s/REPLACEME/REPLACED/g followed by :sg command sequence. Trace the Ex-command handling for :s and confirm that :sg repeats the previous substitution with the global flag. Done means the second line changes to REPLACED REPLACED without E492.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.