diff options
Diffstat (limited to 'tmuxrdr/plugin/bin/select-window')
| -rwxr-xr-x | tmuxrdr/plugin/bin/select-window | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tmuxrdr/plugin/bin/select-window b/tmuxrdr/plugin/bin/select-window new file mode 100755 index 00000000..691d7c9f --- /dev/null +++ b/tmuxrdr/plugin/bin/select-window @@ -0,0 +1,22 @@ +#!/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 |
