Skip to content

Fix Vim Ngg ignoring the count (jump to line N like NG)#13133

Open
tkshsbcue wants to merge 1 commit into
warpdotdev:masterfrom
tkshsbcue:tanay/fix-count-gg-linewise-jump
Open

Fix Vim Ngg ignoring the count (jump to line N like NG)#13133
tkshsbcue wants to merge 1 commit into
warpdotdev:masterfrom
tkshsbcue:tanay/fix-count-gg-linewise-jump

Conversation

@tkshsbcue

Copy link
Copy Markdown
Contributor

Description

In Vim mode, a count before gg was being dropped: 5gg jumped to the first line instead of line 5, even though 5G correctly jumps to line 5. The same applied to the operator-pending and visual variants (d5gg, v5gg).

The gg arms in the normal, operator-pending, and visual handlers always emitted JumpToFirstLine and never read the pending count, while the matching G arms right next to them already branch on the count (get_action_count() / get_operand_count()) and emit JumpToLine(n). This makes the three gg arms mirror their G siblings: with a count they emit JumpToLine(n), and with no count they keep emitting JumpToFirstLine.

Linked Issue

Closes #13132

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below.

Testing

  • I have manually tested my changes locally with ./script/run

Added crates/vim/src/vim_tests.rs, which drives the state machine through key sequences and checks the event it emits:

  • 5gg / 12ggJumpToLine(n), and 12gg produces the same motion as 12G
  • v5ggJumpToLine(5)
  • d3gg → a delete operation with a JumpToLine(3) motion
  • bare gg (no count) → still JumpToFirstLine

I confirmed these tests fail on master (they emit JumpToFirstLine for the counted cases) and pass with the fix. cargo test -p vim, cargo fmt -p vim, and cargo clippy -p vim are all clean.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Fixed a count before gg being ignored in the Vim code editor — 5gg now jumps to line 5, matching 5G.

A count before gg was being dropped: 5gg jumped to the first line
instead of line 5, even though 5G correctly jumps to line 5. The same
applied to the operator-pending and visual variants (d5gg, v5gg).

The gg arms in the normal, operator-pending, and visual handlers always
emitted JumpToFirstLine and never read the pending count, while the
matching G arms right next to them already branch on the count
(get_action_count / get_operand_count) and emit JumpToLine. Make the
three gg arms mirror their G siblings: with a count they emit
JumpToLine(n); with no count they keep emitting JumpToFirstLine.
@cla-bot cla-bot Bot added the cla-signed label Jun 28, 2026
@oz-for-oss

oz-for-oss Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

@tkshsbcue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #13132, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jun 28, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkshsbcue

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #13132, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@tkshsbcue

Copy link
Copy Markdown
Contributor Author

/oz-reivew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vim: a count before gg is ignored (5gg jumps to line 1 instead of line 5)

1 participant