Skip to content

Instantly share code, notes, and snippets.

@kidpixo
Created February 12, 2015 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kidpixo/3f6a5891323491891997 to your computer and use it in GitHub Desktop.
Save kidpixo/3f6a5891323491891997 to your computer and use it in GitHub Desktop.
List hierarchically all window and panes in the input tmux session
# list all panes in the session specified in input
function tmux_list_all_panes
if not set -q $argv
echo $argv
for el in (tmux list-windows -t $argv)
echo " "$el
for elem in (tmux list-pane -t $argv:(echo $el | cut -d":" -f 1))
echo " "$elem
end
end
else
echo "Specify an input target session with -t NAME"
end
end
# add completion to the previous function
complete -x -c tmux_list_all_panes -a '(tmux list-sessions | cut -d":" -f 1)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment