mirror of
1
0
Fork 0

rewrote _apply_bindings() to support new tmux 3.0 bindings (2)

patch the output of 'tmux list-keys' right before sourcing back
This commit is contained in:
Gregory Pakosz 2019-11-29 21:27:50 +01:00
parent 489cde73fc
commit c94f05f044
1 changed files with 5 additions and 3 deletions

View File

@ -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)