zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.58k stars 2.64k forks source link

Terminal: emacs shortcuts not working: alt-f, ctrl-f, alt-b, etc. #14543

Closed bersace closed 1 month ago

bersace commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Hi,

zed is awesome, thanks.

I'm using bash and used to type ctrl-f/alt-f, etc. to move inside the readline editor. It's works perfectly in alacritty. However, in Zed, typeing ctrl-f inserts f. Same for alt-f.

I watched this behaviour with the following shortcuts:

I tried the following keymap without success:

  {
    "context": "Terminal",
    "bindings": {
      "ctrl-f": ["terminal::SendKeystroke", "ctrl-f"],
      "alt-f": ["terminal::SendKeystroke", "alt-f"]
    }
  }

Do you have a clue on what's happening ?

On this subject, default keybings uses a lot ctrl-k as a shortcut prefix. This slows down bare ctrl-k (kill line) in bash. It seems that the default-linux.json keymaps does not cohabitate well with terminal shortcuts.

Regards, Étienne

Environment

Zed: v0.143.7 (Zed)
OS: Linux Wayland debian 12
Memory: 15.3 GiB
Architecture: x86_64

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

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


notpeter commented 1 month ago

Good morning,

Yes, the ctrl-k (cmd-k on mac) is a known outstanding issue:

Sorry to hear that terminal::SendKeystroke is not functioning for you. Do any ctrl/alt shortcuts work for you in terminal or are they all broken? Can you share some more details about your setup (Desktop Environment, Window Manager, keyboard layout, etc).

You may also want to vote for this issue too:

bersace commented 1 month ago

Thanks @notpeter for your anwser.

ctrl-u, ctrl-a and other are working.

I'm running GNOME on Wayland with a French AZERTY keymap. I have Ctrl and Caps lock swapped.

notpeter commented 1 month ago

I wonder if it might be related to this:

bersace commented 1 month ago

I wonder if it might be related to this:

Thanks for the pointer. I don't change keyboard layout while running zed.

Tomato6966 commented 1 month ago

Experiencing similar issue on windows.:

I did a cargo build + run on windows.

When i add a keymap (default is vscode) e.g. "ctrl-k ctrl-f": "editor::Format" i first can't format the code when pressing the keymap, because there is the default map "ctrl-k" which focusses and toggles the searchbar, aka i can't create that keymap as i'm used to in vscode forexample or when i want to add a comment line command for "ctrl-k ctrl-c" it's still the same aka all keymaps which have a "ctrl-k" in it, don't work, cause the searchbar will always get toggled first

Trying to override this keymap also doesn't work.

notpeter commented 1 month ago

@bersace I merged PR #14556 from @CharlesChen0823 to fix this.

Turns out that change is unnecessary and this can be controlled via terminal.option_as_meta in settings.

In #15535 I'm reverting #14556 and changing the option_as_meta default to true. This will land in Zed Preview later today and in Zed Stable in a week (2024-08-06).

Until then you can add the following to your settings:

  "terminal": {
    "option_as_meta": true
  },