0

I'm looking for a tmux command to obtain the current directory (#{pane_current_path}) of the last focused pane, that doesn't require switching to it and switching back.

The following works:

tmux last-pane
echo "$(tmux display-message -pF "#{pane_current_path}")"
tmux last-pane

however I was wondering if there is a way to do this without having to call tmux last-pane twice (perhaps a variable that contains the ID of the last pane?).

1 Answer 1

2

You can use tmux's display-message sub command with -t (target-pane)1 flag. For example you can run

tmux display-message -p -t ! "#{pane_current_path}"

will show details of last pane.


1. https://manpages.debian.org/bookworm/tmux/tmux.1.en.html#Token~2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .