New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve bindings to better match VS-Code #8584
Improve bindings to better match VS-Code #8584
Conversation
We require contributors to sign our Contributor License Agreement, and we don't have @3ddyBoi 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 |
The cla-bot has been summoned, and re-checked this pull request! |
Hey! Thanks for the contribution! Merging this would be a breaking change, since it breaks existing keybindings (people do use |
CC @as-cii @maxbrunsfeld for reconsideration:
I disagree with your assessment. It's a "fixing" change. The reason people use any given keymap is to avoid context switching. Until Zed is a full IDE replacement.
Copied from #4652 (comment):
VS Code has long provided default shortcuts for these exact commands (inspired by JetBrains products).
But it should 100% not break compatibility with VS Code. The mis-mapped shortcuts aren't even niche. They're ones I use every few minutes.
Didn't make sense. Is the implication that Microsoft willy nilly makes breaking changes? NGL I wish they would sometimes! For context my first response to the broken keymap was to uninstall Zed. But I reinstalled it and really like it. I spent too much time identifying which ones were crossed, tracking down related issues, recommending the fix that motivated this PR, and finally following up here. I think a narrowly scoped PR that fixes a demonstrable UX issue for the intersection of {VS Code users} and {Zed users using the VS Code keymap} (all of them?) deserves further discussion. |
Yeah, I see what you're saying. I guess the problem is that our default keymap is the VS Code keymap, but it's not 100% compatible, like you said. So based on the comment you quoted (that
No, sorry, that wasn't clear on my part: I meant that people can change the keybindings in their own I think that convinces me and I'd reopen the PR (if we move those keybindings to JetBrains instead of deleting them, or maybe giving them a new mapping, like Curious now what @as-cii @maxbrunsfeld think here. |
This PR over here changes the |
Should we continue in the other PR if it was more complete than this? If not I can fix the changes you requested in your comment and complete this one.
In VSCode these are taken by duplicate line up/down. |
Let's continue in here. I think what we need:
Then we need to make a decision whether we want to merge this, but let's wait for Antonio/Max here. |
is it possible to create a Zed-specific keymap and also a 100% VScode keymap that maybe used by those trying to transition? I've had challenges replicating certain functionalities that I am used to in VSCode. In particular, toggling the terminal window in zed, works with cmd + j. In VSCode, that would be cmd + `. Though the latter can work in zed, it is not consistent as a terminal toggle. Either creating a separate zed-specific keymap or exposing an option in the settings file, where the keybindings can be set. |
Chiming in to say these incorrect keymap is something that I also noticed immediately after moving to Zed from VSCode and selecting the VSCode keymap (specifically delete line and move line up/down), as these keybindings are something I use all the time. I agree with the author that the expected behavior should be that these keymaps match VSCode if selecting VSCode keymap, which I think will make the transition even smoother for users in the future. |
This would be
This would be
This would be |
|
This is already in Zed's default keymap.
Correct and linked above for reference. |
It is true that the key binding is already a part of Zed's keymap. In VScode, both ctrl + ` and cmd + j toggle the appearance of the lower bottom panel i.e. the terminal. In Zed, pressing cmd + j consistently toggles the bottom panel but ctrl + ` does not. The argument I was trying to make is that this behaviour is inconsistent with VScode where pressing either of the commands in quick succession toggles the visibility of the bottom panel (terminal). |
@isheebo I recommend opening a focused issue to not sidetrack this PR 👍🏼 |
I think we should make this change, even though it will be somewhat disruptive. Since we call it the VS Code keymap, we should match VS Code where possible. There are always going to be some concepts that are not 1:1, but all of the bindings changed here. The disruption stems from mistakes made a long time ago, before we had separate default keycaps for VS Code, JetBrains, etc, and we didn't match VS Code consistently. I'll personally have to get used to |
assets/keymaps/default-macos.json
Outdated
"cmd-shift-k": "editor::DeleteLine", | ||
"alt-up": "editor::MoveLineUp", | ||
"alt-down": "editor::MoveLineDown", | ||
"alt-shift-up": ["workspace::SendKeystrokes", "alt-shift-down up"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see why you had to do this, but I don't like using SendKeystrokes
in this file. Could you add an optional field to the DuplicateLine
action instead? It could be done similarly to the advance_downwards
field of the ToggleComments
action below. For compatibility, we'll need to annotate the field with #[serde(default)]
, to make it optional in key binding files.
PS thanks @mrnugget and @maxbrunsfeld both for a second look 🙏🏼 I appreciate the sensitivity that it not only emulates VS Code but is also the default for everyone. In fairness the only reason I learned VS Code shortcuts years ago was because their JetBrains keymap was lacking. There's certainly room to carve out a dedicated Zed keymap in the future 🔥 |
I wrote some logic, but I did not have time to modify the tests for the duplicate upwards logic. |
I hopped on the branch, implemented the behavior for But I'm not going to merge it yet because I'm not super happy with the |
I can't come up with a better name than |
Maybe |
|
Release Notes:
alt-[up|down]
now move lines up/down andalt-shift-[up|down]
duplicate lines up/down. Previous bindings for selecting larger/smaller syntax nodes are now bound toctrl-shift-[left|right]
. (#4652)(#7151)