Open Hejsil opened 3 years ago
Seems like this is the offender: https://github.com/mawww/kakoune/blob/ce96c3f26246ca1d1ae380e5a14e2880256ded25/rc/windowing/tmux.kak#L19
@krobelus Seems you added these lines. Any reason this was made to only work with splits?
If we used a target pane in the new-window command, we'd get an error:
$ tmux new-window -t $(tmux display-message -p '#{pane_id}')
can't specify pane here
we want to pass the session ID instead:
$ tmux new-window -t $(tmux display-message -p '#{session_id}')
This solution works:
diff --git a/rc/windowing/tmux.kak b/rc/windowing/tmux.kak
index 8e4c7134..fd510022 100644
--- a/rc/windowing/tmux.kak
+++ b/rc/windowing/tmux.kak
@@ -18,6 +18,8 @@ define-command -hidden -params 2.. tmux-terminal-impl %{
tmux_args="$1"
if [ "${1%%-*}" = split ]; then
tmux_args="$tmux_args -t ${kak_client_env_TMUX_PANE}"
+ else
+ tmux_args="$tmux_args -t $(TMUX=$tmux tmux display-message -t ${kak_client_env_TMUX_PANE} -p '#{session_id}')"
fi
shift
# ideally we should escape single ';' to stop tmux from interpreting it as a new command
On a second look, $TMUX
seems to include the session id - it is the last number in a value like /tmp/tmux-1000/default,536,2
So we could just use -t ${kak_client_env_TMUX##*,}
if that's always the case.
Played around with it a little and -t \$${kak_client_env_TMUX##*,}
works (no idea why the prefix $
is needed). I'm a tmux noob, so can't really confirm whether the session is always part of the $TMUX
environment.
The CHANGES
file in the tmux repo has a point:
- Do not use $TMUX to find the session because for windows in multiple sessions it is wrong as often as it is right, and for windows in one session it is pointless. Instead use TMUX_PANE if it is present.
Steps+Outcome
Expected
Expected the fzf command to be show in the kakoune client it was spawned in