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

Terminal + Tmux + Ctrl-Space-Prefix not working #10502

Closed
1 task done
Rocco-Gossmann opened this issue Apr 13, 2024 · 10 comments · Fixed by #11782
Closed
1 task done

Terminal + Tmux + Ctrl-Space-Prefix not working #10502

Rocco-Gossmann opened this issue Apr 13, 2024 · 10 comments · Fixed by #11782
Labels
defect [core label] terminal Feedback for terminal integration, shell commands, etc tooling An umbrella label for language tools, linters, formatters, etc

Comments

@Rocco-Gossmann
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Hi, I'm new to Zed and wanted to give it a try. Coming from NeoVim, My workflow usually involves running various scripts and TUI tools via TMUX.

For convinience I changed TMUX's default Prefix to "Ctrl+Space" (default would be "Ctrl+B").

However, when running TMUX in Zed's Terminal, CTRL-Space does nothing. (Ctrl+B works though).

So my guess is, that something is eating up the Ctrl-Space input. The only binding to that (According to my config) is the default editor::ShowCompletions in the Editor Context.
So when I'm in the Terminal Context, it should be ignored.

How to reproduce

  • Install tmux
  • change the default Prefix by adding the following to your ~/.tmux.conf:
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
  • Open Zed
  • Open Zed's Terminal
  • Run the command in that terminal.
tmux
  • Try pressing ctrl-space ? (By default it should list all of TMUX's Keybindings)

Environment

Zed: v0.130.6 (Zed)
OS: macOS 13.6.0
Memory: 8 GiB
Architecture: aarch64

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

2024-04-13_06-15-48.mov

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

No response

@Rocco-Gossmann Rocco-Gossmann added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Apr 13, 2024
@JosephTLyons JosephTLyons added terminal Feedback for terminal integration, shell commands, etc tooling An umbrella label for language tools, linters, formatters, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Apr 15, 2024
@CharlesChen0823
Copy link
Contributor

might you have key-bindings in settings which using ctrl-space?

@Rocco-Gossmann
Copy link
Author

No, not at all. These are all my mappings so far.
The rest is default.

[
  {
    "context": "!Terminal && vim_mode != insert",
    "bindings": {
      "cmd-j": "workspace::ToggleBottomDock",
      "cmd-h": "workspace::ToggleLeftDock",
      "ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
      "ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
      "ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
      "ctrl-j": ["workspace::ActivatePaneInDirection", "Down"],
      "ctrl-shift-i": "pane::SplitRight",
      "ctrl-_": "pane::SplitDown",
      "ctrl-shift-h": ["workspace::SwapPaneInDirection", "Left"],
      "ctrl-shift-j": ["workspace::SwapPaneInDirection", "Down"],
      "ctrl-shift-k": ["workspace::SwapPaneInDirection", "Up"],
      "ctrl-shift-l": ["workspace::SwapPaneInDirection", "Right"],
      "space f f": "file_finder::Toggle",
      "space tab": "workspace::CloseAllDocks",
      "space q": "editor::GoToDiagnostic"
    }
  },
  {
    "context": "Editor && vim_mode == normal && !VimWaiting",
    "bindings": {
      "ctrl-n": "project_panel::ToggleFocus"
    }
  }
]

I've noticed something else.

When typing a space in the Terminal, the Space character only shows up with a delay or once I type something else. Maybe that has something to do with it.

2024-04-16_09-07-26.mov

@CharlesChen0823
Copy link
Contributor

CharlesChen0823 commented Apr 16, 2024

might be that

@Rocco-Gossmann
Copy link
Author

might be that

Possible. But that should be in the "Editor" Context, not the "Terminal" Context.
I'd love to test if that is the problem, but I don't know how to disable the default mappings.

@CharlesChen0823
Copy link
Contributor

CharlesChen0823 commented Apr 17, 2024

try set the "base_keymap" setting to None.

@Rocco-Gossmann
Copy link
Author

Rocco-Gossmann commented Apr 17, 2024

try set the "base_keymap" setting to None.

Thanks, I just tried it, but it did not help.


Disabling all default mappings somehow fixed the delay of the space character in the terminal, but nothing else.
Ctrl+Space is still not registering.

I even tried disabling all mappings that use „space“ in my „keymap.json“ too.
No changes.

@cemoktra
Copy link

In general there should be an option to allow the terminal to capture key bindings first, i configured nano as editor for git and i can't use Ctrl + O to save changes, cause it tries to open a file.

@Rocco-Gossmann
Copy link
Author

@cemoktra

In general there should be an option to allow the terminal to capture key bindings first, i configured nano as editor for git and i can't use Ctrl + O to save changes, cause it tries to open a file.

you can define what keys get captured where by defining a context property at the same level as the bindings property in your keymap.json.
Unfortunatly there is no good documentation what can go into a context.
For example !Terminal does NOT work but !Editor somehow does?!

@mirageN1349

This comment was marked as spam.

@MaxThom
Copy link

MaxThom commented May 13, 2024

I am also facing the same issue! I got tmux on ctrl+space and the keys are not being registered.

mrnugget pushed a commit that referenced this issue May 14, 2024
Close #10502 

Release Notes:

- Fixed `ctrl-space` not being forwarded correctly in the terminal view.
([#10502](#10502))
osiewicz pushed a commit to RemcoSmitsDev/zed that referenced this issue May 18, 2024
Close zed-industries#10502 

Release Notes:

- Fixed `ctrl-space` not being forwarded correctly in the terminal view.
([zed-industries#10502](zed-industries#10502))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] terminal Feedback for terminal integration, shell commands, etc tooling An umbrella label for language tools, linters, formatters, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants