Vim search */# without moving cursor initially#46244
Vim search */# without moving cursor initially#46244ConradIrwin merged 3 commits intozed-industries:mainfrom
Conversation
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.
|
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 check |
|
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'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@cla-bot check |
|
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'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
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: but unfortunately that doesn't work because 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. |
|
This approach would pollute the jumplist even if it worked. Should I push changes to at least have these actions available? @ConradIrwin |
|
I'm ok with that idea, thanks! |
|
I reverted the 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? |
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:
*and#search doesn't jump immediately to next / previous search.