Skip to content

Vim search */# without moving cursor initially#46244

Merged
ConradIrwin merged 3 commits intozed-industries:mainfrom
a-hariti:vim-search-without-move
Jan 9, 2026
Merged

Vim search */# without moving cursor initially#46244
ConradIrwin merged 3 commits intozed-industries:mainfrom
a-hariti:vim-search-without-move

Conversation

@a-hariti
Copy link
Contributor

@a-hariti a-hariti commented Jan 7, 2026

The default behavior for Vim search with * and # in normal mode is to initiate a search and immediately jump to the next or previous match respectively.

This behavior can be annoying, so Vim has many plugins to address this specifically:

This PR tries to emulate this behavior natively keeping up with Zed's sane defaults and deviating from vanilla Vim when it makes sense.

Release Notes:

  • Vim: * and # search doesn't jump immediately to next / previous search.

In vim mode, the  search in normal mode no longer jumps to the
second match imeediately. It now highlights all matches as it
currently does, but stays put until  is pressed.
@cla-bot
Copy link

cla-bot bot commented Jan 7, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @a-hariti on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@a-hariti
Copy link
Contributor Author

a-hariti commented Jan 7, 2026

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jan 7, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @a-hariti on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Jan 7, 2026

The cla-bot has been summoned, and re-checked this pull request!

@a-hariti
Copy link
Contributor Author

a-hariti commented Jan 7, 2026

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jan 7, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @a-hariti on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Jan 7, 2026

The cla-bot has been summoned, and re-checked this pull request!

@a-hariti
Copy link
Contributor Author

a-hariti commented Jan 7, 2026

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 7, 2026
@cla-bot
Copy link

cla-bot bot commented Jan 7, 2026

The cla-bot has been summoned, and re-checked this pull request!

@ConradIrwin
Copy link
Member

Thanks for the idea!

We should not change the default behavior of * or #.

Ideally you'd be able to get the behavior you want with something like this in your bindings file:

{"*": ["workspace::SendKeystrokes", "m l * ` l"]}

but unfortunately that doesn't work because * is async. (Which is on the list of things to figure out one day)

We could add these actions, and just not bind them by default, but Zed also has cmd-f if you want to just see matches without navigating to them.

@ConradIrwin ConradIrwin closed this Jan 7, 2026
@a-hariti
Copy link
Contributor Author

a-hariti commented Jan 7, 2026

This approach would pollute the jumplist even if it worked.

Should I push changes to at least have these actions available? @ConradIrwin

@ConradIrwin
Copy link
Member

I'm ok with that idea, thanks!

@a-hariti
Copy link
Contributor Author

a-hariti commented Jan 8, 2026

I reverted the vim.json bindings on the same branch.

Tested it locally and it works both in normal and visual mode.

[
  {
    "context": "Editor && vim_mode == normal",
    "bindings": {
      "*": "vim::SearchUnderCursor",
      "#": "vim::SearchUnderCursorPrevious"
     }
  }
]

Can you please reopen the PR and fetch changes?
or should I open another one?

@ConradIrwin ConradIrwin reopened this Jan 9, 2026
@ConradIrwin ConradIrwin enabled auto-merge (squash) January 9, 2026 04:03
@ConradIrwin ConradIrwin merged commit 1fb2922 into zed-industries:main Jan 9, 2026
24 of 39 checks passed
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.

2 participants