zed icon indicating copy to clipboard operation
zed copied to clipboard

VS code keybinding: move item up and down

Open jacmacmod opened this issue 1 year ago • 5 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

In vs code to move a line up it should be option key + arrow key up or down. Right now it seems to be using control key + command + arrow key up or down.

Environment

Zed: v0.91.3 (stable) OS: macOS 13.4.1 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

jacmacmod avatar Jun 28 '23 02:06 jacmacmod

I wanted the same, and have the following in my ~/.config/zed/keymap.json

[
  {
    "context": "Editor",
    "bindings": {
      "alt-up": "editor::MoveLineUp",
      "alt-down": "editor::MoveLineDown",
      "alt-shift-up": "editor::DuplicateLine",
      "alt-shift-down": "editor::DuplicateLine",
    }
  }
]

ojkelly avatar Jun 29 '23 06:06 ojkelly

editor::DuplicateLine keeps the cursor on the new line (always "copying down"), while in VSCode you can both copy lines up and down. Is there a paramater for this keybind (e.g. like editor::SelectNext has replace_newest)? Is there maybe a page with all available keybindings and their parameters? @JosephTLyons

DanielBreiner avatar Jul 17 '23 18:07 DanielBreiner

I think this should work as default.

gbrrrl-no avatar Feb 16 '24 16:02 gbrrrl-no

I think this should work as default.

I'm on Zed version 0.123.2 and I have set base keymap to VSCode. It seems MoveLineUp MoveLineDown DuplicateLineUp DuplicateLineDown is still not binded to the same as it is in VSCode.

3ddyBoi avatar Feb 22 '24 12:02 3ddyBoi

It looks like alt-up and alt-down are taken by editor::SelectLargerSyntaxNode and editor::SelectSmallerSyntaxNode. But I think those are from JetBrains. The VS Code defaults should be:

{
  "context": "Editor",
  "bindings": {
    "cmd-shift-k": "editor::DeleteLine",
    "alt-shift-down": "editor::DuplicateLine",
    "alt-down": "editor::MoveLineDown",
    "alt-up": "editor::MoveLineUp",
    "ctrl-shift-right": "editor::SelectLargerSyntaxNode",
    "ctrl-shift-left": "editor::SelectSmallerSyntaxNode"
  }
}

Should we just PR that?

texastoland avatar Feb 24 '24 22:02 texastoland

I'm going to close this issue as the patch has already been shipped in v0.126.0.

Moshyfawn avatar Mar 10 '24 00:03 Moshyfawn

the patch has already been shipped in v0.126.0.

Edit: 8352f39 now in v0.127.0-pre (mentioned in Breaking changes). Credit to @3ddyBoi for getting it done 🚀

texastoland avatar Mar 13 '24 19:03 texastoland