1
0
Fork 0
mirror of synced 2024-12-04 14:45:38 -05:00

fixup! added support for configuration files in the following locations: - ~/.tmux.conf and ~/.tmux.conf.local - $XDG_CONFIG_HOME/tmux/tmux.conf and $XDG_CONFIG_HOME/tmux/tmux.conf.local - ~/.config/tmux/tmux.conf and ~/.config/tmux/tmux.conf.local

This commit is contained in:
Gregory Pakosz 2023-01-29 15:01:59 +01:00
parent 4dd5502c7e
commit 2505c76f88

View file

@ -4,7 +4,7 @@
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# /!\ do not edit this file
# instead, override settings in ~/.tmux.conf.local, see README.md
# instead, override your .local copy, see README.md
# -- general -------------------------------------------------------------------
@ -25,10 +25,10 @@ setw -q -g utf8 on
set -g history-limit 5000 # boost history
# edit configuration
bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c '${EDITOR:-vim} "$TMUX_CONF_LOCAL" && "$TMUX_EXECUTABLE" source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
bind e new-window -n "#{TMUX_CONF_LOCAL}" sh -c '${EDITOR:-vim} "$TMUX_CONF_LOCAL" && "$TMUX_PROGRAM" source "$TMUX_CONF" \; display "$TMUX_CONF_LOCAL sourced"'
# reload configuration
bind r run '"$TMUX_EXECUTABLE" source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
bind r run '"$TMUX_PROGRAM" source "$TMUX_CONF"' \; display "#{TMUX_CONF} sourced"
# -- display -------------------------------------------------------------------
@ -120,16 +120,16 @@ bind -T copy-mode-vi H send -X start-of-line
bind -T copy-mode-vi L send -X end-of-line
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Wayland clipboard
if -b 'command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | wl-copy"'
if -b 'command -v wl-copy > /dev/null 2>&1' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - | wl-copy"'
# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | reattach-to-user-namespace pbcopy"'
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"$TMUX_EXECUTABLE\" save-buffer - > /dev/clipboard"'
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"$TMUX_PROGRAM\" save-buffer - > /dev/clipboard"'
# -- buffers -------------------------------------------------------------------
@ -141,17 +141,17 @@ bind P choose-buffer # choose which buffer to paste from
# -- 8< ------------------------------------------------------------------------
%if #{==:#{TMUX_EXECUTABLE},}
run 'TMUX_EXECUTABLE="$(lsof -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || printf tmux)"; $TMUX_EXECUTABLE -S #{socket_path} set-environment -g TMUX_EXECUTABLE "$TMUX_EXECUTABLE"'
%if #{==:#{TMUX_PROGRAM},}
run 'TMUX_PROGRAM="$(lsof -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null || printf tmux)"; $TMUX_PROGRAM -S #{socket_path} set-environment -g TMUX_PROGRAM "$TMUX_PROGRAM"'
%endif
%if #{==:#{TMUX_CONF},}
run '"$TMUX_EXECUTABLE" set-environment -g TMUX_CONF $(for conf in "$HOME/.tmux.conf" "$XDG_CONFIG_HOME/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"; do [ -f "$conf" ] && printf "%s" "$conf" && break; done)'
run '"$TMUX_PROGRAM" set-environment -g TMUX_CONF $(for conf in "$HOME/.tmux.conf" "$XDG_CONFIG_HOME/tmux/tmux.conf" "$HOME/.config/tmux/tmux.conf"; do [ -f "$conf" ] && printf "%s" "$conf" && break; done)'
%endif
%if #{==:#{TMUX_CONF_LOCAL},}
run '"$TMUX_EXECUTABLE" set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF.local"'
run '"$TMUX_PROGRAM" set-environment -g TMUX_CONF_LOCAL "$TMUX_CONF.local"'
%endif
run '"$TMUX_EXECUTABLE" source "$TMUX_CONF_LOCAL"'
run '"$TMUX_PROGRAM" source "$TMUX_CONF_LOCAL"'
run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# EOF
@ -177,16 +177,16 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# [ -z "$TMUX" ] && exit 666
# TMUX_SOCKET=$(printf '%s' "$TMUX" | cut -d, -f1)
#
# if [ -z "$TMUX_EXECUTABLE" ]; then
# if [ -z "$TMUX_PROGRAM" ]; then
# TMUX_PID=$(printf '%s' "$TMUX" | cut -d, -f2)
# TMUX_EXECUTABLE=$(lsof -b -w -a -d txt -p "$TMUX_PID" -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/$TMUX_PID/exe" 2>/dev/null || printf tmux)
# TMUX_PROGRAM=$(lsof -b -w -a -d txt -p "$TMUX_PID" -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g) { print; exit } } exit 1; {" || readlink "/proc/$TMUX_PID/exe" 2>/dev/null || printf tmux)
# fi
# if [ x"$TMUX_EXECUTABLE" = x"tmux" ]; then
# TMUX_EXECUTABLE="command tmux"
# if [ x"$TMUX_PROGRAM" = x"tmux" ]; then
# TMUX_PROGRAM="command tmux"
# fi
#
# tmux() {
# "$TMUX_EXECUTABLE" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@"
# "$TMUX_PROGRAM" ${TMUX_SOCKET:+-S "$TMUX_SOCKET"} "$@"
# }
#
# _tmux_version=$(tmux -V | awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}')
@ -256,12 +256,12 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# if [ -z "$restore" ]; then
# [ "$(tmux list-panes -t "$current_session:" | wc -l | sed 's/^ *//g')" -eq 1 ] && tmux display "Can't maximize with only one pane" && return
# current_pane_height=$(tmux display -t "$current_pane" -p "#{pane_height}")
# info=$(tmux new-window -t "$current_session:" -F "#{session_name}:#{window_index}.#{pane_id}" -P "maximized... 2>/dev/null & \"$TMUX_EXECUTABLE\" ${TMUX_SOCKET:+-S \"$TMUX_SOCKET\"} setw -t \"$current_session:\" remain-on-exit on; printf \"\\034[\$(tput lines);0fPane has been maximized, press <prefix>+ to restore\n\" '$current_pane'")
# info=$(tmux new-window -t "$current_session:" -F "#{session_name}:#{window_index}.#{pane_id}" -P "maximized... 2>/dev/null & \"$TMUX_PROGRAM\" ${TMUX_SOCKET:+-S \"$TMUX_SOCKET\"} setw -t \"$current_session:\" remain-on-exit on; printf \"\\034[\$(tput lines);0fPane has been maximized, press <prefix>+ to restore\n\" '$current_pane'")
# session_window=${info%.*}
# new_pane=${info#*.}
#
# retry=20
# while [ x"$("$TMUX_EXECUTABLE" -S "$TMUX_SOCKET" list-panes -t "$session_window" -F '#{session_name}:#{window_index}.#{pane_id} #{pane_dead}' 2>/dev/null)" != x"$info 1" ] && [ "$retry" -ne 0 ]; do
# while [ x"$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" list-panes -t "$session_window" -F '#{session_name}:#{window_index}.#{pane_id} #{pane_dead}' 2>/dev/null)" != x"$info 1" ] && [ "$retry" -ne 0 ]; do
# sleep 0.1
# retry=$((retry - 1))
# done
@ -653,7 +653,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# now=$(date +%s)
# esac
# # shellcheck disable=SC1004
# awk -v tmux="$TMUX_EXECUTABLE" -v boot="$boot" -v now="$now" '
# awk -v tmux="$TMUX_PROGRAM" -v boot="$boot" -v now="$now" '
# BEGIN {
# uptime = now - boot
# y = int(uptime / 31536000)
@ -775,9 +775,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
# if ! _is_disabled "$tmux_conf_new_pane_retain_current_path"; then
# perl -p -i -e "
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+#\{b:pane_tty\}([^\n\1]*)(\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- ~\/.tmux.conf | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\2\5\1/g
# s/\brun-shell\b\s+(\"|')cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_split_window\s+#\{b:pane_tty\}([^\n\1]*)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\4)([^\n\1]*)\1/run-shell \1cut -c3- \2 | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\3\5\1/g
# ;
# s/\brun-shell\b(\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{b:pane_tty\}\3)(.*?)\2/split-window\4/g
# s/\brun-shell\b(?:\s+((?:\\\\\")?|\"?|'?)cut\s+-c3-\s+(?:.+?)\s+\|\s+sh\s+-s\s+_split_window\s+((?:\\\\\")?|\"?|'?)#\{b:pane_tty\}\2)(.*?)\1/split-window\3/g
# ;
# s/\bsplit-window\b([^;}\n]*?)(?:\s+-c\s+((?:\\\\\")?|\"?|'?)#\{pane_current_path\}\2)/split-window\1/g" \
# "$cfg"
@ -794,12 +794,12 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# fi
#
# perl -p -i -e "
# s/\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window_ssh #\{pane_pid\} #\{b:pane_tty\}\1'/g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\
# s,\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?(?:\s+(\bssh\b))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!\bssh\b)[^\s]+))*)?,run-shell 'cut -c3- \"$TMUX_CONF\" | sh -s _split_window_ssh #\{pane_pid\} #\{b:pane_tty\}\1',g if /\bsplit-window\b((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?(?:\s+(ssh))((?:(?:[ \t]+-[bdfhIvP])|(?:[ \t]+-[celtF][ \t]+(?!ssh)[^\s]+))*)?/"\
# "$cfg"
#
# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
# if ! _is_disabled "$tmux_conf_new_pane_reconnect_ssh" && _is_true "$tmux_conf_new_pane_reconnect_ssh"; then
# perl -p -i -e "s/\bsplit-window\b([^;}\n\"]*)/run-shell 'cut -c3- ~\/\.tmux\.conf | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\1'/g" "$cfg"
# perl -p -i -e "s,\bsplit-window\b([^;}\n\"]*),run-shell 'cut -c3- \"$TMUX_CONF\" | sh -s _split_window #\{pane_pid\} #\{b:pane_tty\}\1',g" "$cfg"
# fi
#
# if ! _is_disabled "$tmux_conf_new_pane_retain_current_path" && _is_true "$tmux_conf_new_pane_retain_current_path"; then
@ -808,9 +808,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# ;
# s/\bsplit-window\b/split-window -c '#{pane_current_path}'\1/g
# ;
# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_pid\} #\{b:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\2'/g if /\bdisplay-menu\b/
# s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _split_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \\\\\"#\{pane_current_path\}\\\\\"\3'/g if /\bdisplay-menu\b/
# ;
# s/\brun-shell\b\s+'cut\s+-c3-\s+~\/\.tmux\.conf\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- ~\/.tmux.conf | sh -s _split_window\1 #\{pane_pid\} #\{b:pane_tty\} -c \"#\{pane_current_path\}\"\2'/g" \
# s/\brun-shell\b\s+'cut\s+-c3-\s+(.+?)\s+\|\s+sh\s+-s\s+_split_window(_ssh)?\s+#\{pane_pid\}\s+#\{b:pane_tty\}([^}\n']*)'/run-shell 'cut -c3- \1 | sh -s _split_window\2 #\{pane_pid\} #\{b:pane_tty\} -c \"#\{pane_current_path\}\"\3'/g" \
# "$cfg"
# fi
#
@ -1294,9 +1294,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# status_right="#(echo; nice cut -c3- '$TMUX_CONF' | sh -s _battery_status '$tmux_conf_battery_status_charging' '$tmux_conf_battery_status_discharging')$status_right"
# interval=60
# if [ $_tmux_version -ge 320 ]; then
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$('$TMUX_EXECUTABLE' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_bar '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_length' '$tmux_conf_battery_bar_palette' '$tmux_conf_battery_hbar_palette' '$tmux_conf_battery_vbar_palette'; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$('$TMUX_PROGRAM' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_bar '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_length' '$tmux_conf_battery_bar_palette' '$tmux_conf_battery_hbar_palette' '$tmux_conf_battery_vbar_palette'; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# elif [ $_tmux_version -ge 280 ]; then
# status_right="#(echo; while [ x\"\$('$TMUX_EXECUTABLE' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_bar '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_length' '$tmux_conf_battery_bar_palette' '$tmux_conf_battery_hbar_palette' '$tmux_conf_battery_vbar_palette'; sleep $interval; done)$status_right"
# status_right="#(echo; while [ x\"\$('$TMUX_PROGRAM' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_bar '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_length' '$tmux_conf_battery_bar_palette' '$tmux_conf_battery_hbar_palette' '$tmux_conf_battery_vbar_palette'; sleep $interval; done)$status_right"
# elif [ $_tmux_version -gt 240 ]; then
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_bar '$tmux_conf_battery_bar_symbol_full' '$tmux_conf_battery_bar_symbol_empty' '$tmux_conf_battery_bar_length' '$tmux_conf_battery_bar_palette' '$tmux_conf_battery_hbar_palette' '$tmux_conf_battery_vbar_palette'; sleep $interval; done)$status_right"
# else
@ -1349,9 +1349,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# ;;
# esac
# if [ $_tmux_version -ge 320 ]; then
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$('$TMUX_EXECUTABLE' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$('$TMUX_PROGRAM' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# elif [ $_tmux_version -ge 280 ]; then
# status_right="#(echo; while [ x\"\$('$TMUX_EXECUTABLE' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
# status_right="#(echo; while [ x\"\$('$TMUX_PROGRAM' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
# elif [ $_tmux_version -gt 240 ]; then
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
# else
@ -1369,9 +1369,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g')
# interval=$(tmux show -gv status-interval)
# if [ $_tmux_version -ge 320 ]; then
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$('$TMUX_EXECUTABLE' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# tmux run -b "trap '[ -n \"\$sleep_pid\" ] && kill -9 \"\$sleep_pid\"; exit 0' TERM; while [ x\"\$('$TMUX_PROGRAM' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
# elif [ $_tmux_version -ge 280 ]; then
# status_right="#(echo; while [ x\"\$('$TMUX_EXECUTABLE' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
# status_right="#(echo; while [ x\"\$('$TMUX_PROGRAM' -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
# elif [ $_tmux_version -gt 240 ]; then
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
# else
@ -1414,57 +1414,64 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
# tmux display 'Done uninstalling tpm and plugins...'
# fi
# else
# if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | uniq
# $(printf '%s' "$tpm_plugins")
# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' ~/.config/tmux/tmux.conf.local 2>/dev/null)
# EOF
# )
# tmux set -g '@tpm_plugins' "$tpm_plugins"
# if [ x"$TMUX_PROGRAM" = x"$(command -v tmux)" ]; then
#
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
# tmux display 'Installing tpm and plugins...'
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
# elif { [ -z "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_reload"; }; then
# update_tpm=true
# tmux display 'Updating tpm and plugins...'
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master)
# fi
# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then
# perl -0777 -p -i -e 's/git clone(?!\s+--depth\s+1)/git clone --depth 1/g
# ;s/(install_plugin(.(?!&))*)\n(\s+)done/\1&\n\3done\n\3wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"
# perl -p -i -e 's/git submodule update --init --recursive(?!\s+--depth\s+1)/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"
# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh"
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# fi
# if [ x"$update_tpm" = x"true" ]; then
# {
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# tmux display 'Done updating tpm and plugins...'
# } || tmux display 'Failed updating tpm and plugins...'
# elif [ x"$install_tpm" = x"true" ]; then
# {
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1
# tmux display 'Done installing tpm and plugins...'
# } || tmux display 'Failed installing tpm and plugins...'
# if git ls-remote -hq https://github.com/gpakosz/.tmux.git master > /dev/null; then
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }'
# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' "$TMUX_CONF_LOCAL" 2>/dev/null)
# EOF
# )
# tmux set -g '@tpm_plugins' "$tpm_plugins"
#
# if [ ! -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
# install_tpm=true
# tmux display 'Installing tpm and plugins...'
# git clone --depth 1 https://github.com/tmux-plugins/tpm "$TMUX_PLUGIN_MANAGER_PATH/tpm"
# elif { [ -z "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_launch"; } || { [ -n "$window_active" ] && _is_true "$tmux_conf_update_plugins_on_reload"; }; then
# update_tpm=true
# tmux display 'Updating tpm and plugins...'
# (cd "$TMUX_PLUGIN_MANAGER_PATH/tpm" && git fetch -q -p && git checkout -q master && git reset -q --hard origin/master)
# fi
# if [ x"$install_tpm" = x"true" ] || [ x"$update_tpm" = x"true" ]; then
# perl -0777 -p -i -e 's/git clone(?!\s+--depth\s+1)/git clone --depth 1/g
# ;s/(install_plugin(.(?!&))*)\n(\s+)done/\1&\n\3done\n\3wait/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/install_plugins.sh"
# perl -p -i -e 's/git submodule update --init --recursive(?!\s+--depth\s+1)/git submodule update --init --recursive --depth 1/g' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/update_plugin.sh"
# perl -p -i -e 's,\$tmux_file\s+>/dev/null\s+2>\&1,$& || { tmux display "Plugin \$(basename \${plugin_path}) failed" && false; },' "$TMUX_PLUGIN_MANAGER_PATH/tpm/scripts/source_plugins.sh"
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
# fi
# if [ x"$update_tpm" = x"true" ]; then
# {
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 &&\
# tmux display 'Done updating tpm and plugins...'
# } || tmux display 'Failed updating tpm and plugins...'
# elif [ x"$install_tpm" = x"true" ]; then
# {
# echo "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins ..." > "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1 && \
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt" 2>&1
# tmux display 'Done installing tpm and plugins...'
# } || tmux display 'Failed installing tpm and plugins...'
# fi
# else
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
# fi
#
# [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I'
# [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u'
# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed"
# else
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
# tmux run -b "sleep $(expr $($TMUX_PROGRAM display -p '#{display-time}') / 500) && '$TMUX_PROGRAM' set display-time 3000 \; display 'Cannot use tpm which assumes a globally installed tmux' \; set -u display-time"
# fi
#
# [ -z "$(tmux show -gqv '@tpm-install')" ] && tmux set -g '@tpm-install' 'I'
# [ -z "$(tmux show -gqv '@tpm-update')" ] && tmux set -g '@tpm-update' 'u'
# [ -z "$(tmux show -gqv '@tpm-clean')" ] && tmux set -g '@tpm-clean' 'M-u'
# [ -f "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" ] && "$TMUX_PLUGIN_MANAGER_PATH/tpm/tpm" || tmux display "One or more tpm plugin(s) failed"
# if [ $_tmux_version -gt 260 ]; then
# tmux set -gu '@tpm-install' \; set -gu '@tpm-update' \; set -gu '@tpm-clean' \; set -gu '@plugin' \; set -gu '@tpm_plugins'
# else
# tmux set -g '@tpm-install' '' \; set -g '@tpm-update' '' \; set -g '@tpm-clean' '' \; set -g '@plugin' '' \; set -g '@tpm_plugins' ''
# fi
# fi
# }