From a1e431d3e135015c34594e6056cbabd5fea9d196 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 8 Sep 2022 18:34:18 +0200 Subject: [PATCH] tmux: Use shell script to complete `selfinsert` Use a short shell script to complete the `selfinsert` keytable by binding all keys that have a mapping in the root table. --- .config/tmux/tmux.conf | 13 ++++++++++--- .config/tmux/tmux_selfinsert.sh | 8 ++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 .config/tmux/tmux_selfinsert.sh diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index a3c1f5b..e39cb9b 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -97,9 +97,16 @@ bind -T resize 4 selectl main-vertical \; switchc -T resize bind -T resize 5 selectl tiled \; switchc -T resize bind r switchc -T resize -# Allow C-h to still be passed (when programs expect it as backspace, e.g. UEFI -# shell) -bind -r -T selfinsert C-h send C-h +# Create a key-table which self-inserts all keys that are bound in the root key +# table. (C-h for example is sometimes needed as backspace sequence) +# +# tmux_selfinsert.sh: +# +# tmux list-keys -T root | awk '{print $4}' | while read key; do +# tmux bind -r -T selfinsert "$key" send +# done + +run-shell -b "$XDG_CONFIG_HOME/tmux/tmux_selfinsert.sh" bind C-v switchc -T selfinsert # Synchronize the panes in the current window with `S` diff --git a/.config/tmux/tmux_selfinsert.sh b/.config/tmux/tmux_selfinsert.sh new file mode 100755 index 0000000..d5b3362 --- /dev/null +++ b/.config/tmux/tmux_selfinsert.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Create a key-table which self-inserts all keys that are bound in the root key +# table. (C-h for example is sometimes needed as backspace sequence) + +tmux list-keys -T root | awk '{print $4}' | while read key; do + tmux bind -r -T selfinsert "$key" send +done