Skip to content
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

Global shortcuts override any interactions inside the Zed terminal #14299

Closed
1 task done
swaptr opened this issue Jul 12, 2024 · 2 comments
Closed
1 task done

Global shortcuts override any interactions inside the Zed terminal #14299

swaptr opened this issue Jul 12, 2024 · 2 comments
Labels
keybinds Keyboard shortcuts, mapping, binding, keymaps, etc support User support (non-defect troubleshooting, documentation, etc)

Comments

@swaptr
Copy link

swaptr commented Jul 12, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When using Zed, its global shortcuts interfere with terminal interactions, such as those in programs like nano. For instance, Zed uses Ctrl + O to open a new project, conflicting with nano's Ctrl + O shortcut for saving files. This conflict prevents nano from responding to its expected actions when trying to save a file.

Steps to reproduce:

  1. Open a terminal inside Zed Ctrl + ` .
  2. Open any file using nano: nano Cargo.toml.
  3. Save the changes in the file using nano's shortcut Ctrl + O.

Expected behavior:

  1. Nano should respond by triggering its file save prompt.

#Environment
Zed: v0.143.6 (stable)
Operating System: Fedora Linux 40
Memory: 16 GiB
Architecture: x86_64

TL;DR:

Disabling conflicting keybindings when a terminal is active would resolve this issue.

@swaptr swaptr added admin read bug [core label] labels Jul 12, 2024
@ncpa0cpl
Copy link

I am facing similar issue, I am using micro for editing commit messages and the keybindings for saving and exiting (Ctrl+s, Ctrl+q) are being handled only by Zed and not the micro running in the terminal.

Imho when the terminal is in focus all keystrokes should be only directed to the terminal, Zed should completely ignore them, otherise there will always be some key combinations that are impossible to pass in to the program running in the terminal.

@notpeter
Copy link
Member

Yeah, these are hard. Both the terminal and the application may want shortcut keys with ctrl. Especially with other editors (emacs, nano, micro, etc). I'm not sure the right balance, but it's easy enough to fix:

Just add a custom keymap (cmd-shift-p, zed: open keymap) and paste the following:

[
  {
    "context": "Terminal",
    "bindings": {
      // Directly pass these keys to terminal apps instead of having Zed handle them.
      "ctrl-o": ["terminal::SendKeystroke", "ctrl-o"],
      "ctrl-s": ["terminal::SendKeystroke", "ctrl-s"],
      "ctrl-q": ["terminal::SendKeystroke", "ctrl-q"]
    }
  }
]

Let me know if that doesn't work.

@notpeter notpeter added keybinds Keyboard shortcuts, mapping, binding, keymaps, etc support User support (non-defect troubleshooting, documentation, etc) and removed triage bug [core label] labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keybinds Keyboard shortcuts, mapping, binding, keymaps, etc support User support (non-defect troubleshooting, documentation, etc)
Projects
None yet
Development

No branches or pull requests

3 participants