X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=tmux-window.pl;h=9f3971cdde7e1d7e25856b2986f2c9b7a9cb518a;hb=8246405a007bc1a4e9ba0454f0ebb0d97f616ec3;hp=b16529b379fa52e1085a3692f205a0e58cae25c5;hpb=3f5d80c3a9142c424ca2c482b6ad28c475349d42;p=config%2Fdotfiles.git diff --git a/tmux-window.pl b/tmux-window.pl index b16529b..9f3971c 100644 --- a/tmux-window.pl +++ b/tmux-window.pl @@ -20,6 +20,9 @@ # unbind-key -n 9 \; \ # unbind-key -n \\; # this unmaps ; # +# Due to Tmux's handling of errors (they abort the rest of the mapping) the +# select-window command is actually executed as last part of the mapping. +# # If a secondary chaining (e.g. prefix ;;3) is requested, a second file like # the generated one must be loaded with ; to jump to windows 20-29. Therefore # the following line is added in this case. @@ -75,11 +78,14 @@ if (defined $path and $path !~ m{^/}) { for (my $i = 0; $i < 10; $i++) { - print "bind-key -n $i select-window -t :$level$i \\; "; + print "bind-key -n $i "; for (my $j = 0; $j < 10; $j++) { print "unbind-key -n $j \\; "; } - print "unbind-key -n \\\\;\n"; + print "unbind-key -n \\\\; \\; "; + # Do the select-window last. If the window doesn't exist the failing + # select-window command prevents unbinding the other keys. + print "select-window -t :$level$i\n"; } if (defined $path) {