-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Missing VS Code keybindings for duplicating and moving lines #4703
Comments
Update, found similar in Zed's Sublime BindingsFound the line-moving in Zed's Sublime Bindings as: {
"ctrl-cmd-up": "editor::MoveLineUp",
"ctrl-cmd-down": "editor::MoveLineDown",
} And The duplicating ( So now I have this// ~/.config/zed/keymap.json
[
// Additional VS Code bindings...
{
"context": "Editor",
"bindings": {
"alt-up": "editor::MoveLineUp",
"alt-down": "editor::MoveLineDown",
"alt-shift-down": "editor::DuplicateLine"
}
}
] This actually covers most of my use-cases. Even though it's not smart with indents like vscode (see screen-recording above), it's not the end of the world. When #5448 drops I can probably main Zed without pain. |
@ryanwinchester can I close this one out given that you found the commands you were looking for? There's definitely some room for improvement, but the core functionality should all be there. 🙂 |
@hovsater I left it in case we had something to track with being smart about indentation levels and “duplicate above” functionality, but I’m okay with closing. 👍 |
There is also missing [
{
"context": "Editor",
"bindings": {
"alt-up": "editor::MoveLineUp",
"alt-down": "editor::MoveLineDown",
"alt-shift-down": "editor::DuplicateLine",
"cmd-d": "editor::DuplicateLine"
}
}
] |
@hovsater Maybe this deserves a new card, but after |
Slightly related, but I'm also trying to copy over all my VS Code bindings and since I couldn't find "move line up" or something similar in the documentation, I found this thread very helpful! I also missed cmd-shift-k to delete the current line, it was easy to add:
|
@hovsater I'd not consider the core functionality to be there currently. In VS code, you can |
It may sound simplistic, but I think these missing shortcuts are a major blocker for adoption by VS Code users. A few of my colleagues completely dismissed Zed because it just takes some muscle memory to get used to the new shortcuts. A better strategy for Zed would be to fully match all the VS Code shortcuts out of the box, if not by default, with a simple button to get all the bindings setup. This will remove a big part of the friction. |
We have dedicated keymaps for other editors, including VSCode. |
Is there both a duplicate line above and duplicate line below now? Or still just |
Oh, that's the point, I see (sorry, starting to forget what VSCode actions are at this point). zed/crates/editor/src/actions.rs Line 154 in 7956a9a
and that one is duplicating things below. It feels relatively simple to add another action (and a test) to duplicate above too, but indeed it's more work and characters typed than any of comments above 🙂 |
I will learn rust someday, but it's not today 😅 |
I didn't know Zed had some keymap files for other editors. Maybe those keybinding options could be added to a menu where a simple non contributor user could see the list of default available keymaps to quickly choose their preferred keymap without having to dig inside the Zed GitHub issues + Zed codebase + figure out how to do key bindings? At this point I am not a code contributor to Zed, so the best I can do is to contribute to the discussion, if that is something that is appreciated by the community. These code changes might be obvious/easy to the committed contributor, but newcomers could spend a significant amount of time to resolve them. Maybe their two cents are still valuable to the community? |
Discoverability is always a problem for developers, so that's why I always ask external people to add to docs: they know it better. For me, that was "obvious" (not for others, as it's clear to see) as there's a cmd-shift-p universal "execute everything" thing that contains base keymaps: and also there are docs on the topic: https://github.com/zed-industries/zed/blob/main/docs/src/configuring_zed__key_bindings.md At this point, I'm clueless what else could be done to make it more visible, but anybody is welcome to bring ideas on making things better. |
Added
|
I think these have landed in Zed v0.126.0, so I'll close this out. |
I'm not sure that |
@Moshyfawn I have investigated a bit and i see this: In the future release it will be |
I see! Thanks for the info, it does make sense 👍 |
for anyone who stumbles across this issue because they were used to the previous non-vscode-based key bindings (which i believe were based on atom’s key bindings) and they want those key bindings back, open your key bindings config (Zed › Settings… › Open Key Bindings or from the command-palette, [
{
"context": "Editor",
"bindings": {
"ctrl-shift-k": "editor::DeleteLine",
"cmd-shift-d": "editor::DuplicateLine",
"ctrl-cmd-down": "editor::MoveLineDown",
"ctrl-cmd-up": "editor::MoveLineUp"
}
}
] (there are probably more, but those were the three that i ran into right away) |
for Zed [
{
"context": "Editor",
"bindings": {
"cmd-up": "editor::MoveLineUp",
"cmd-down": "editor::MoveLineDown",
"cmd-shift-d": "editor::DuplicateLineDown"
}
}
]
|
On linux: 24 |
Check for existing issues
Describe the feature
A) Moving lines or selections
Was partially mentioned in #6079 but not addressed (and I haven't seen another issue yet with these ones).
alt-up
move current line (or selected lines) upalt-down
move current line (or selected lines) downB) Duplicating lines or selections
alt-shift-up
duplicate current line (or selected lines) abovealt-shift-down
duplicate current line (or selected lines) belowIf applicable, add mockups / screenshots to help present your vision of the feature
VS Code behaviour on duplicating and moving line(s):
Screen.Recording.2023-06-14.at.9.56.43.PM.mov
The text was updated successfully, but these errors were encountered: