vim-tmux-navigator
vim-tmux-navigator copied to clipboard
MacOS `Cmd + k` stopped working with the tmux plugin
This keystroke is intended for clearing terminal buffer on MacOS.
MacOS 10.15.5 tmux 3.1b neovim 0.4.3 Alacritty 0.4.3
The plugin should not have any effect on keybindings using Cmd unless you're using a non-standard setup. Also, just to confirm, the default configuration of the plugin does interfere with Ctrl-l for clear screen, but we have notes on restoring that functionality. Just wanted to highlight in case this is what you're referring to.
Otherwise, some additional questions to help figure this out:
- Are you a new user of the plugin and experiencing this with your first setup, or have you used the plugin before with success?
- Did this breakage come with an upgrade of any of the listed OS, tmux, or vim versions?
- Does this just "not work", or does it behave in an unexpected way?
My setup is standard with no customizations related to the plugin. I refer specifically to Cmd + k because this is the main way to clear terminal on MacOS when you working with it.
- I experienced this issue every time I tried to use the plugin. There were a few times I tried it.
- No, I don't think so.
- Yes, the keystroke in tmux just stop working when I enable the plugin.
By the way, this may be important, I use the Alacritty 0.4.3 terminal emulator.
Cmd+K still switches splits instead of clearing terminal. Any plans to fix that?
By the way, this may be important, I use the Alacritty 0.4.3 terminal emulator.
Hi @osenvosem I have noticed many things not working out-of-the-box myself with Alacritty; most noticeably this plugin. Although I'm not a Mac user, I believe issues like alacritty/alacritty#2204 are relevant to me and you. I've not gone to investigate much further that this.
Is the ⌘-k key combo is defined via Alacritty by binding this to the usual Ctrl-k to clear end of the line ?
I briefly investigated this issue on my Mac, I think the issue lies with
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
When you press cmd-k the terminal emulator remaps it to Ctrl+l command to the terminal. But Tmux with the config above captures it and interprets the command as select-pane to the right.
I have rebound my keyboard with Karabiner and use alacritty as my terminal emulator. Ideally alacritty could send a clear screen command another way instead of the rebinding, but I suspect that terminals take Ctrl+l to clear screen by default.
For now I'm content typing clear. Would love to hear other people's thoughts/work-arounds on this!
So I have found a work around which isn't perfect like Ctrl+l. If you're using alacritty you can add a keyboard binding to send clear\n whenever you press cmd+k. Here is my alacritty.toml config snippet:
[keyboard]
bindings = [
{ key = "k", mods = "Command", chars = "clear -x\n" },
]
The -x flag ensures the history of window is still accessible if you scroll up [ref].
This workaround leaves a blank line at the top which is a little unflattering, but functionally it's good enough for me.