#!/bin/sh # tmux prefix+0 and prefix+' (select-window -t :=N). Herdr numbers tabs by # their place in the tab bar, from 1 -- like tmux with base-index 1 and # renumber-windows on -- so N is a position: 0 finds nothing, exactly as # prefix+0 does under this machine's base-index 1. With no argument it prompts # for the index, as prefix+' does (run as a popup). . "$(dirname "$0")/../lib.sh" n="${1:-}" if [ -z "$n" ]; then printf '(index) ' IFS= read -r n || exit 0 fi [ -n "$n" ] || exit 0 case "$n" in *[!0-9]*) fail "can't find window: $n" ;; esac ws="$(pane_info "$(active_pane)" workspace_id)" tab="$(workspace_tabs "$ws" | sed -n "${n}p" | cut -f1)" [ "$n" -gt 0 ] && [ -n "$tab" ] || fail "can't find window: $n" "$H" tab focus "$tab" >/dev/null