From c94f05f044484f1c72002229c254cc1196e16ac7 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Fri, 29 Nov 2019 21:27:50 +0100 Subject: [PATCH] rewrote _apply_bindings() to support new tmux 3.0 bindings (2) patch the output of 'tmux list-keys' right before sourcing back --- .tmux.conf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index ac4006c..9cf02fb 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -682,9 +682,7 @@ run -b '[ -z "#{session_id}" ] && [ -z "#{version}" ] && tmux set display-time 3 # _apply_bindings() { # cfg=$(mktemp) && trap 'rm -f $cfg*' EXIT # -# # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings -# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E '(new-window|split(-|_)window|new-session|copy-selection|copy-pipe)' | awk \ -# '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg" +# tmux list-keys | grep -vF 'tmux.conf.local' | grep -E '(new-window|split(-|_)window|new-session|copy-selection|copy-pipe)' > "$cfg" # # # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the # # output of list-keys can be truncated @@ -758,6 +756,10 @@ run -b '[ -z "#{session_id}" ] && [ -z "#{version}" ] && tmux set display-time 3 # fi # fi # +# # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings +# awk < "$cfg" \ +# '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg" +# # # ignore bindings with errors # while ! out=$(tmux source-file "$cfg"); do # line=$(printf "%s" "$out" | cut -d':' -f2)