Closed muffin4 closed 1 year ago
True. This is indeed an issue. I think it's one of the reasons Ctrl-g
was chosen, since there aren't that many uses for it. Out of curiosity: is there a specific use this is blocking for you?
Also: do you have a suggestion on a UX for this?
I noticed that I'm unable to send Ctrl-g
when I tried to use it in vim to print the current file name.
Some solution that come to mind are these:
Change the keybind to leave locked mode to esc
. You can already send esc
in normal mode, though you might want to send esc
in locked mode without wanting to leave locked mode.
If Ctrl-g
is the first key entered in locked mode: send Ctrl-g
and leave locked mode. This behavior is similar to Ctrl-b Ctrl-b
with the default tmux config, but this prevents users from leaving locked mode without sending anything if they entered it by accident.
Add a keybind that sends only the next character, like Ctrl-v
in vim's insert mode.
* Add a keybind that sends only the next character, like `Ctrl-v` in vim's insert mode.
This is my favorite solution. I would also:
Ctrl-g
and change the current behaviour to happen with Ctrl-G
(uppercase G
). This way we can make just a minor change to the interface by changing it to <g/G> LOCK
-- INTERFACE LOCKED --
indication for the lowercase variant (the temporary one) to -- INTERFACE TEMPORARILY LOCKED --
to make it clear to the user.What do you think?
I also think that this is the best solution.
(I'm unsure if terminals are able to detect ctrl-shift-g, btw - if that doesn't work we might have to change it to a different char)
This would improve on a feature that tmux has that Zellij doesn't, the ability to pass through the prefix key.
Which in this case is an improvement over Tmux's solution of a separate keybind just to pass through the prefix keybind.
(I'm unsure if terminals are able to detect ctrl-shift-g, btw - if that doesn't work we might have to change it to a different char)
This should work, it should come through as Ctrl('G')
in our Key
struct :)
From some initial tests using Ctrl + key or Ctrl +shift + key both have the same behavior. i.e both Ctrl+r and Ctrl+Shift+r will switch to the Resize mode.
We're definitely not alone in having this problem, and there are a number of different approaches:
The screen one will mean that my default screen bindings require me to Ctrl+g g g
in order to send Ctrl+g
to the shell if I run zellij under screen for persistence :D
I just came accross the same issue: "Ctrl-g" is used to open the help screen in the nano editor. Instead of a help screen you get a lock in the terminal. "Ctrl-r" is also a nano command.
I think @dantepippi is working on a fix for this, right? Meanwhile, a workaround here can be to change the keybindings: https://zellij.dev/documentation/keybindings.html
An idea would be to use some Ctrl which you normally don't need for other stuff like Emacs or nano. In screen I used to use "Ctrl-J" (instead of "Ctrl-A" which is needed for Emacs). Using this as first control sequence and then a second letter for zellij (e.g. Ctrl-j + q instead of just Ctrl-q for terminating) could be a good option. But this is just my opinion.
Here a workaround for nano:
Any workaround for vim with Ctrl-g
combination?
I tried something like this but it doesn't help. Seems like zellij still prevents passing through Ctrl-g
combination to vim.
keybinds {
locked {
bind "Alt g" { SwitchToMode "Normal"; }
bind "Ctrl g" {} // Cancel default binding
}
shared_except "locked" {
bind "Alt g" { SwitchToMode "Locked"; }
bind "Ctrl g" {} // Cancel default binding
}
}
I also tried this way but in this case zellij still toggles lock mode with Ctrl-g
. Even if there is no bind "Ctrl g"
in a config file.
keybinds {
locked {
bind "Alt g" { SwitchToMode "Normal"; }
}
shared_except "locked" {
bind "Alt g" { SwitchToMode "Locked"; }
}
}
I think this is a very old issue and can be closed.
@vyalovvldmr - you'll need to explicitly unbind "Ctrl g" in all modes (and hopefully bind it to something else). You can look into overriding keys here if you like: https://zellij.dev/documentation/keybindings-binding.html#overriding-keys
has this issue been addressed? I think this is the only thing that blocks most of user from using zellij as a main terminal multiplexer. and so do i.
as it may affect nano, emacs, any kind of CUI applications.
has this issue been addressed? I think this is the only thing that blocks most of user from using zellij as a main terminal multiplexer. and so do i.
as it may affect nano, emacs, any kind of CUI applications.
Completely agree. Many apps use control-g. In emacs it is even the most important shortcut since this might be the only key that saves you from an emacs hang up.
Friends, I want to stress again: we can bind/unbind/rebind any key in the config by changing one line. I changed the issue title accordingly to try and make it as clear as possible. I don't know how to make this clearer. :) More info here: https://zellij.dev/documentation/keybindings.html
While I can empathize with wanting things to work just the way you like them out of the box - and I do agree we can do more in that area and indeed plan to - it takes less effort to adjust this in the config than it took me to write this comment.
That is definitely an improvement over it having to be ctrl+g. However, whichever key you choose, you won't be able to send that one to internal programs.
I find an interested reddit thread where the OP shares how he handled the keybinding conflict with TUI pogram like vim/emacs...
It would be useful for people who wants to try zellij but doesn't get used to its keybindings.
That is definitely an improvement over it having to be ctrl+g. However, whichever key you choose, you won't be able to send that one to internal programs.
Here is my hacking to send a real Alt-g
to the terminal (I use alt-g
instead of ctrl-g
for the lock mode switching key):
locked {
bind "Alt g" { SwitchToMode "Normal"; }
}
normal {
bind "Alt g" { SwitchToMode "Locked"; }
}
shared_except "locked" {
bind "Ctrl a" { SwitchToMode "Tmux"; }
bind "Alt p" { SwitchToMode "Pane"; }
bind "Alt r" { SwitchToMode "Resize"; }
bind "Alt s" { SwitchToMode "Scroll"; }
bind "Alt o" { SwitchToMode "Session"; }
bind "Alt t" { SwitchToMode "Tab"; }
bind "Alt m" { SwitchToMode "Move"; }
bind "Alt g" { Write 27 7015; SwitchToMode "Normal"; } // send a real Alt+g to the terminal
}
So with this setting, in any mode (like Pane, Resize, Scroll, or whatever mode), press Alt-g
to send a real Alt-g
to the terminal, and in normla mode, press Alt-g
to enter the lock mode.
FWIW I think this bug should be re-opened and something like https://github.com/zellij-org/zellij/issues/418#issuecomment-830019834 implemented. It was rather confusing coming across this as a new user and other multiplexers having some solution to this.
I could not fully understand how to encode "ctrl + 'a'" using a write action as keybinding?!? Because I realized the I was unable to send Ctrl+a, Ctrl+k, Ctrl+y and Ctrl+e to a ZSH terminal session running in a pane. Instead the "^A", "^K" is printed.
Description
With the default config I can't seem to find a way to send
Ctrl-g
to any programs I run in zellij because it's the key to both enter and exist the locked mode.You can send any other key that's already used by the default config by entering the locked mode with
Ctrl-g
, then hitting the key you want to send, and leaving locked mode withCtrl-g
again, but that doesn't work forCtrl-g
itself.Information