Skip to content

Conversation

@xipeng-jin
Copy link
Contributor

Closes #14801, #4930

Summary:

  • Add Beam Jump feature-gated state machine with arbitrary-length patterns, highlights, label safety, and ;/, repeats.
  • Integrate Beam Jump motions, repeats, and multi-cursor handling into Vim normal mode with editor highlight support.
  • Expand test suite to cover Beam Jump behaviors (labels, overflow, backfill, repeats, pass-through, primary cursor only, V==0 fallback).

Description:

  • Introduce BeamJumpState, label assignment, and motion logic, plus viewport-scoped match tracking and global fallback search.
  • Add editor highlight plumbing to display Beam Jump outlines and labels, and ensure only the primary cursor moves when using Beam Jump motions.
  • Gate the feature through Vim settings (beam_jump), keeping Sneak behavior unchanged when disabled.
  • Extend motion repeat handling so ;/, work with arbitrary-length Beam Jump patterns, including global navigation after exit.
  • Add comprehensive tests validating labeling rules, overflow/backfill, pass-through keys, ;/, interaction, V==0 fallback, and multi-cursor constraints.

Release Notes:

  • Added Beam Jump optional feature for Vim Sneak: arbitrary-length patterns, labeled jumps, and repeatable global navigation.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 19, 2025
@xipeng-jin xipeng-jin marked this pull request as draft December 19, 2025 18:17
@P1n3appl3 P1n3appl3 self-requested a review December 19, 2025 18:47
Copy link

@ecstatic-morse ecstatic-morse left a comment

Choose a reason for hiding this comment

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

I'm not part of Zed, just a user who is excited about this functionality finally landing. I tried this locally and it looks great!

I pretty much exclusively use easy motion's bidirectional mode, so it's a little disappointing to see that part missing. It doesn't work as nicely with ;, but it's faster than having to decide between forward and backward before starting a jump.

];

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum BeamJumpDirection {

Choose a reason for hiding this comment

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

You probably want to reuse workspace::searchable::Direction for this.

Comment on lines +9 to +12
const BASE_LABEL_CHARS: &[char] = &[
'f', 'j', 'd', 'k', 's', 'l', 'a', 'g', 'h', 'r', 'u', 'e', 'i', 'o', 'w', 'm', 'n', 'c', 'v',
'x', 'z', 'p', 'q', 'y', 't', 'b',
];

Choose a reason for hiding this comment

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

It would be nice to let the user configure this in case they don't use QWERTY.

Comment on lines +2826 to +2831
fn reverse_beam_jump_direction(direction: BeamJumpDirection) -> BeamJumpDirection {
match direction {
BeamJumpDirection::Forward => BeamJumpDirection::Backward,
BeamJumpDirection::Backward => BeamJumpDirection::Forward,
}
}

Choose a reason for hiding this comment

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

Already a method on workspace::searchable::Direction

Comment on lines +715 to +717
if VimSettings::get_global(cx).beam_jump {
vim.start_beam_jump(BeamJumpDirection::Forward, action.first_char, window, cx);
}

Choose a reason for hiding this comment

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

It's kind of strange to reuse the PushSneak operators here. It means the user can't one mapping for sneak and another for beam jump. Is there a reason you can't introduce new operators just for beam jump?

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

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flash.nvim style search in a document.

2 participants