Has anyone set up kakoune repl or connect/kakoune.cr with wezterm?

I’ve recently switched to wezterm due to it supporting linux hidpi, ligatures, and having a terminal multiplexer built in that looks like it beats the pants out of tmux (and so far it does in my day of usage). However, the inbuilt repl plugin and things like connect.kak don’t yet have support for opening wezterm’s panes (it opens a new terminal just fine). I’m pretty sure I can figure out setting termcmd and stuff like that to get it to work, but I figured maybe someone has done the legwork and we can document it here (or in the wiki) for future wezterm/kakoune users.

Curious what the win conditions are for a better multiplexer?

Tmux introduces another io layer on top of the terminal, whereas the built-in multiplexing in wezterm does not (its the same io layer with or without panes, tabs and windows). Wezterm also expands the concept of sessions to include remote sessions through ssh or even tls. For a remote that doesn’t have wezterm on it, it can manage the connection such that opening a new tab/pane/window opens over the same connection without needing screen or tmux on the remote, which means no need to send tmux leader twice to get through the local tmux to the remote one. This keeps window/pane/tab management simple. If wezterm is on the remote, the tls session type will keep your session alive accross networks, as you roam from wifi to wired to hotspot.

1 Like

You can use F12 as a passthru using the below (no more double-keys.

bind -T root F12  \
  set prefix None \;\
  set key-table off \;\
  set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\
  set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
  set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
  if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
  refresh-client -S \;\

bind -T off F12 \
  set -u prefix \;\
  set -u key-table \;\
  set -u status-style \;\
  set -u window-status-current-style \;\
  set -u window-status-current-format \;\
  refresh-client -S
  
wg_is_keys_off="#[fg=$color_light,bg=$color_window_off_indicator]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[default]"
1 Like

There is a nice demo from the author on reddit.

1 Like

@alexherbo2 thanks for the links. I was able to get everything working with this in my kakrc:

hook global ModuleLoaded x11 %{
  set-option global termcmd 'wezterm cli split-pane -- sh -c'
}

It should be noted for anyone reading this that to get horizontal splits you’ll need to pass --horizontal to split-pane before the --.

Speaking of which, how do I specify whether i want horizontal or vertical with :new and :>?

1 Like

You can’t.

You can however add a mapping to set the terminal command. It would be quite equivalent to the i3 way to set the vertical or horizontal split.

Relatedly, there’s also this plugin that detects if you’re running in Wezterm and defines terminal, terminal-window, and terminal-tab