Merge branch 'gpakosz:master' into master
This commit is contained in:
commit
ee9661c001
3 changed files with 158 additions and 58 deletions
207
.tmux.conf
207
.tmux.conf
|
@ -144,8 +144,7 @@ bind P choose-buffer # choose which buffer to paste from
|
|||
# -- 8< ------------------------------------------------------------------------
|
||||
|
||||
%if #{==:#{TMUX_PROGRAM},}
|
||||
run "exec sh -c 'TMUX_PROGRAM=\"\$(LSOF=\$(PATH=\"\$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\" command -v lsof); \$LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e \"if (s/^n((?:.(?!dylib\$|so\$))+)\$/\\1/g && s/(?:\s+\\([^\\s]+?\\))?\$//g) { print; exit } } exit 1; {\" || readlink \"/proc/#{pid}/exe\" 2>/dev/null)\"; { [ -f \"\$TMUX_PROGRAM\" ] && [ -x \"\$TMUX_PROGRAM\" ]; } || TMUX_PROGRAM=\"\$(command -v tmux || printf tmux)\"; \"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_PROGRAM \"\$TMUX_PROGRAM\"'"
|
||||
#run 'TMUX_PROGRAM="$(LSOF=$(PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command -v lsof); $LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e "if (s/^n((?:.(?!dylib$|so$))+)$/\1/g && s/(?:\s+\([^\s]+?\))?$//g) { print; exit } } exit 1; {" || readlink "/proc/#{pid}/exe" 2>/dev/null)"; { [ -f "$TMUX_PROGRAM" ] && [ -x "$TMUX_PROGRAM" ]; } || TMUX_PROGRAM="$(command -v tmux || printf tmux)"; "$TMUX_PROGRAM" -S #{socket_path} set-environment -g TMUX_PROGRAM "$TMUX_PROGRAM"'
|
||||
run "exec sh -c 'TMUX_PROGRAM=\"\$(LSOF=\$(PATH=\"\$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\" command -v lsof); \$LSOF -b -w -a -d txt -p #{pid} -Fn 2>/dev/null | perl -n -e \"if (s/^n((?:.(?!dylib\$|so\$))+)\$/\\1/g && s/(?:\s+\\([^\\s]+?\\))?\$//g) { print; exit } } exit 1; {\" 2>/dev/null || readlink \"/proc/#{pid}/exe\" 2>/dev/null)\"; [ x\"\$(\"\$TMUX_PROGRAM\" display -p \"#{l:#{pid}}\" 2>/dev/null)\" = x\"#{pid}\" ] || TMUX_PROGRAM=\"\$(command -v tmux || printf tmux)\"; \"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_PROGRAM \"\$TMUX_PROGRAM\"'"
|
||||
%endif
|
||||
%if #{==:#{TMUX_SOCKET},}
|
||||
run "exec sh -c '\"\$TMUX_PROGRAM\" -S #{socket_path} set-environment -g TMUX_SOCKET \"#{socket_path}\"'"
|
||||
|
@ -157,7 +156,7 @@ bind P choose-buffer # choose which buffer to paste from
|
|||
run "exec sh -c '\"\$TMUX_PROGRAM\" set-environment -g TMUX_CONF_LOCAL \"\$TMUX_CONF.local\"'"
|
||||
%endif
|
||||
|
||||
run '"$TMUX_PROGRAM" source "$TMUX_CONF_LOCAL"'
|
||||
run '"$TMUX_PROGRAM" -S #{socket_path} source "$TMUX_CONF_LOCAL"'
|
||||
run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||
|
||||
# EOF
|
||||
|
@ -165,6 +164,8 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# # exit the script if any statement returns a non-true return value
|
||||
# set -e
|
||||
#
|
||||
# unset SHELL
|
||||
#
|
||||
# unset GREP_OPTIONS
|
||||
# export LC_NUMERIC=C
|
||||
# # shellcheck disable=SC3041
|
||||
|
@ -189,7 +190,8 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# fi
|
||||
# if [ -z "$TMUX_PROGRAM" ]; then
|
||||
# TMUX_PID=$(printf '%s' "$TMUX" | cut -d, -f2)
|
||||
# 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)
|
||||
# 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; {" 2>/dev/null || readlink "/proc/$TMUX_PID/exe" 2>/dev/null)
|
||||
# [ "$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = "$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux)
|
||||
# fi
|
||||
# if [ "$TMUX_PROGRAM" = "tmux" ]; then
|
||||
# tmux() {
|
||||
|
@ -204,7 +206,14 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# _tmux_version=$(tmux -V | perl -n -e '($l, $r) = $_ =~ /^[^0-9]+([0-9.]+)([a-z])?(-rc.*)?$/; print $l * 1000 + ($r eq "" ? 0 : ord($r) - 96)')
|
||||
#
|
||||
# _is_true() {
|
||||
# [ "$1" = "true" ] || [ "$1" = "yes" ] || [ "$1" = "1" ]
|
||||
# case "$1" in
|
||||
# true|yes|1)
|
||||
# return 0
|
||||
# ;;
|
||||
# *)
|
||||
# return 1
|
||||
# ;;
|
||||
# esac
|
||||
# }
|
||||
#
|
||||
# _is_enabled() {
|
||||
|
@ -230,6 +239,14 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# printf '%s' "$*" | perl -CS -pe 's/(\\u([0-9A-Fa-f]{1,4})|\\U([0-9A-Fa-f]{1,8}))/chr(hex($2.$3))/eg' 2>/dev/null
|
||||
# }
|
||||
#
|
||||
# _pretty_path() {
|
||||
# max_length=${1:-auto}; shift
|
||||
# if [ "$max_length" = "auto" ]; then
|
||||
# max_length=$(($(tmux -q display -p '#{client_width}') / 4))
|
||||
# fi
|
||||
# { cd "$*" && pwd || printf '%s' "$*"; } | perl -s -p -E 's|^$HOME|~|; /^.{0,$max_length}$/ || s|(~?\/[^/]+)(/[^/]+)(?:/.+)(/[^/]+)$|$1$2/...$3|g' -- -HOME="$HOME" -max_length="$max_length"
|
||||
# }
|
||||
#
|
||||
# if command -v pkill > /dev/null 2>&1; then
|
||||
# _pkillf() {
|
||||
# pkill -f "$@" || true
|
||||
|
@ -258,6 +275,31 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# esac
|
||||
# fi
|
||||
#
|
||||
# if perl -MTime::HiRes -e1; then
|
||||
# _timestamp() {
|
||||
# while IFS= read -r line; do
|
||||
# printf '\t%s\n' "$line" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe '($s, $us) = gettimeofday(); printf ("[%s.%03d]", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# done
|
||||
# }
|
||||
# else
|
||||
# case "$_uname_s" in
|
||||
# Darwin)
|
||||
# _timestamp() {
|
||||
# while IFS= read -r line; do
|
||||
# printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.000")" "$line"
|
||||
# done
|
||||
# }
|
||||
# ;;
|
||||
# *)
|
||||
# _timestamp() {
|
||||
# while IFS= read -r line; do
|
||||
# printf '[%s]\t%s\n' "$(date +"%Y-%m-%d %H:%M:%S.%3N")" "$line"
|
||||
# done
|
||||
# }
|
||||
# ;;
|
||||
# esac
|
||||
# fi
|
||||
#
|
||||
# _bar() {
|
||||
# bar_palette=$(printf '%s' "$1" | tr ';' ',')
|
||||
# bar_symbol_empty=$2
|
||||
|
@ -563,7 +605,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# battery_status="$battery_status_charging"
|
||||
# fi
|
||||
#
|
||||
# tmux set -g '@battery_status' "$battery_status"
|
||||
# tmux set -g '@battery_status' "$battery_status" >/dev/null 2>/dev/null
|
||||
# }
|
||||
#
|
||||
# _pane_info() {
|
||||
|
@ -571,14 +613,18 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# pane_tty="${2##/dev/}"
|
||||
# case "$_uname_s" in
|
||||
# *CYGWIN*)
|
||||
# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" '
|
||||
# ps -al | tail -n +2 | awk -v pane_pid="$pane_pid" -v tty="$pane_tty" -v ssh="$(command -v ssh)" '
|
||||
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ &!/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ && $5 == tty {
|
||||
# user[$1] = $6; if (!child[$2]) child[$2] = $1
|
||||
# }
|
||||
# END {
|
||||
# pid = pane_pid
|
||||
# while (child[pid])
|
||||
# while (child[pid]) {
|
||||
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||
# break
|
||||
# }
|
||||
# pid = child[pid]
|
||||
# }
|
||||
#
|
||||
# file = "/proc/" pid "/cmdline"; getline command < file; close(file)
|
||||
# gsub(/\0/, " ", command)
|
||||
|
@ -588,28 +634,36 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# '
|
||||
# ;;
|
||||
# *Linux*)
|
||||
# ps -t "$pane_tty" --sort=lstart -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" '
|
||||
# ps -t "$pane_tty" --sort=lstart -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" -v ssh="$(command -v ssh)" '
|
||||
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ {
|
||||
# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||
# }
|
||||
# END {
|
||||
# pid = pane_pid
|
||||
# while (child[pid])
|
||||
# while (child[pid]) {
|
||||
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||
# break
|
||||
# }
|
||||
# pid = child[pid]
|
||||
# }
|
||||
#
|
||||
# print pid":"user[pid]":"command[pid]
|
||||
# }
|
||||
# '
|
||||
# ;;
|
||||
# *)
|
||||
# ps -t "/dev/$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" '
|
||||
# ps -t "/dev/$pane_tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk -v pane_pid="$pane_pid" -v ssh="$(command -v ssh)" '
|
||||
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ && !/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ {
|
||||
# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||
# }
|
||||
# END {
|
||||
# pid = pane_pid
|
||||
# while (child[pid])
|
||||
# while (child[pid]) {
|
||||
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||
# break
|
||||
# }
|
||||
# pid = child[pid]
|
||||
# }
|
||||
#
|
||||
# print pid":"user[pid]":"command[pid]
|
||||
# }
|
||||
|
@ -864,7 +918,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# if _is_true "$tmux_conf_preserve_stock_bindings"; then
|
||||
# probe_socket="$(dirname "$TMUX_SOCKET")/tmux-stock-bindings-$$"
|
||||
# TMUX_SOCKET="$probe_socket" tmux -f /dev/null list-keys >> "$cfg"
|
||||
# rm -f "%probe_socket"
|
||||
# rm -f "$probe_socket"
|
||||
# fi
|
||||
#
|
||||
# # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
|
||||
|
@ -1363,6 +1417,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# set_titles_string=$(printf '%s' "${tmux_conf_theme_terminal_title:-$(tmux show -gv set-titles-string)}" | sed \
|
||||
# -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \
|
||||
# -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \
|
||||
# -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \
|
||||
# -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \
|
||||
# -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \
|
||||
# -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \
|
||||
|
@ -1373,6 +1428,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# window_status_format=$(printf '%s' "${window_status_format:-$(tmux show -gv window-status-format)}" | sed \
|
||||
# -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \
|
||||
# -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \
|
||||
# -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \
|
||||
# -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \
|
||||
# -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \
|
||||
# -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \
|
||||
|
@ -1383,6 +1439,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# window_status_current_format=$(printf '%s' "${window_status_current_format:-$(tmux show -gv window-status-current-format)}" | sed \
|
||||
# -e "s%#{circled_window_index}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#I')%g" \
|
||||
# -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \
|
||||
# -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \
|
||||
# -e "s%#{username}%#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' false '#D')%g" \
|
||||
# -e "s%#{hostname}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false false '#h' '#D')%g" \
|
||||
# -e "s%#{hostname_full}%#(cut -c3- '$TMUX_CONF' | sh -s _hostname '#{pane_pid}' '#{b:pane_tty}' false true '#H' '#D')%g" \
|
||||
|
@ -1396,6 +1453,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# -e "s/#{mouse}/#{?mouse,$tmux_conf_theme_mouse ,$(printf '%s' "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \
|
||||
# -e "s%#{synchronized}%#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \
|
||||
# -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \
|
||||
# -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \
|
||||
# -e "s%#{root}%#{?#{==:#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' '#D'),root},$tmux_conf_theme_root,}%g")
|
||||
#
|
||||
# status_right=$(printf '%s' "${status_right-$(tmux show -gv status-right)}" | sed \
|
||||
|
@ -1404,6 +1462,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# -e "s/#{mouse}/#{?mouse,$tmux_conf_theme_mouse ,$(printf '%s' "$tmux_conf_theme_mouse" | sed -e 's/./ /g') }/g" \
|
||||
# -e "s%#{synchronized}%#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \
|
||||
# -e "s%#{circled_session_name}%#(cut -c3- '$TMUX_CONF' | sh -s _circled '#S')%g" \
|
||||
# -e "s%#{pretty_pane_current_path}%#(cut -c3- '$TMUX_CONF' | sh -s _pretty_path auto '#{pane_current_path}')%g" \
|
||||
# -e "s%#{root}%#{?#{==:#(cut -c3- '$TMUX_CONF' | sh -s _username '#{pane_pid}' '#{b:pane_tty}' '#D'),root},$tmux_conf_theme_root,}%g")
|
||||
#
|
||||
# tmux_conf_battery_bar_symbol_full=$(_decode_unicode_escapes "${tmux_conf_battery_bar_symbol_full:-◼}")
|
||||
|
@ -1438,16 +1497,16 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# -e "s%#\{battery_vbar\}%#(nice cut -c3- '$TMUX_CONF' | sh -s _vbar '$(printf '%s' "$tmux_conf_battery_vbar_palette" | tr ',' ';')' '#{@battery_charge}')%g" \
|
||||
# -e 's%#\{(\?)?battery_status%#\{\1@battery_status%g' \
|
||||
# -e 's%#\{(\?)?battery_percentage%#\{\1@battery_percentage%g')
|
||||
# status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _battery_status '$tmux_conf_battery_status_charging' '$tmux_conf_battery_status_discharging')$status_right"
|
||||
# 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" -eq 3500 ]; then
|
||||
# tmux run -b "exec sh -c '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_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done'"
|
||||
# elif [ "$_tmux_version" -ge 3200 ]; then
|
||||
# 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_info; sleep $interval & sleep_pid=\$!; wait \"\$sleep_pid\"; sleep_pid=; done"
|
||||
# elif [ "$_tmux_version" -ge 2800 ]; then
|
||||
# status_right="#(while [ x\"\$(\"$TMUX_PROGRAM\" -S '#{socket_path}' display -p '#{l:#{pid}}')\" = x\"#{pid}\" ]; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; 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_info; sleep $interval; done)$status_right"
|
||||
# elif [ "$_tmux_version" -gt 2400 ]; then
|
||||
# status_right="#(while :; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right"
|
||||
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _battery_info; sleep $interval; done)$status_right"
|
||||
# else
|
||||
# status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _battery_info)$status_right"
|
||||
# fi
|
||||
|
@ -1502,9 +1561,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# elif [ "$_tmux_version" -ge 3200 ]; then
|
||||
# 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 2800 ]; then
|
||||
# status_right="#(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"
|
||||
# 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 2400 ]; then
|
||||
# status_right="#(while :; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
|
||||
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _uptime; sleep $interval; done)$status_right"
|
||||
# else
|
||||
# status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _uptime)$status_right"
|
||||
# fi
|
||||
|
@ -1524,9 +1583,9 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# elif [ "$_tmux_version" -ge 3200 ]; then
|
||||
# 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 2800 ]; then
|
||||
# status_right="#(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"
|
||||
# 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 2400 ]; then
|
||||
# status_right="#(while :; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
|
||||
# status_right="#(echo; while :; do nice cut -c3- '$TMUX_CONF' | sh -s _loadavg; sleep $interval; done)$status_right"
|
||||
# else
|
||||
# status_right="#(nice cut -c3- '$TMUX_CONF' | sh -s _loadavg)$status_right"
|
||||
# fi
|
||||
|
@ -1562,8 +1621,48 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# fi
|
||||
# mkdir -p "$TMUX_PLUGIN_MANAGER_PATH"
|
||||
#
|
||||
# __discover_plugins() (
|
||||
# probe_socket="$(dirname "$TMUX_SOCKET")/tmux-discover-plugins-$$"
|
||||
# TMUX_SOCKET="$probe_socket" tmux -f /dev/null start-server \; set-option exit-empty off
|
||||
# ___discover_plugins() {
|
||||
# depth=$((${depth:-0} + 1))
|
||||
# IFS=${_IFS:-$IFS}
|
||||
# [ "$depth" -le 100 ] || return
|
||||
# for current_file in "$@"; do
|
||||
# current_file="$(cd "${current_file%/*}" 2>/dev/null && pwd)/${current_file##*/}" || continue
|
||||
# while IFS= read -r line; do
|
||||
# if plugin=$(printf '%s\n' "$line" | perl -s -n -E 'print if s/^set-option\s+-g\s+\@plugin\s+//g or die' 2>/dev/null); then
|
||||
# discovered_plugins="${discovered_plugins}${discovered_plugins:+ }${plugin}"
|
||||
# elif next_files=$(printf '%s\n' "$line" | perl -s -n -E 's/(?<!\@)current_file/\@current_file/g ; print if s/^source(?:-file)?(?:\s+-[qF]+)*\s*(.+?)$/\1/g or die' 2>/dev/null); then
|
||||
# next_files=$(TMUX_SOCKET="$probe_socket" tmux -f /dev/null \
|
||||
# set -g @current_file "$current_file" \; \
|
||||
# display -pF "$next_files")
|
||||
#
|
||||
# _IFS="$IFS"
|
||||
# IFS=$(printf '\n\nx')
|
||||
# IFS=${IFS%?}
|
||||
# # we don't want quoting here as we want wildcard expansion
|
||||
# # shellcheck disable=SC2046
|
||||
# ___discover_plugins $(printf '%s\n' "$next_files" | xargs printf '%s\n\n')
|
||||
# fi
|
||||
# done << EOF
|
||||
# $(TMUX_SOCKET="$probe_socket" tmux -f /dev/null source -nvq "$current_file" | perl -s -n -E 'print if s/^$current_file:\d+:\s*(set-option\s+-g\s+\@plugin\s+|source-file)/\1/g' -- -current_file="$current_file")
|
||||
# EOF
|
||||
# done
|
||||
# }
|
||||
# ___discover_plugins "$@"
|
||||
# TMUX_SOCKET="$probe_socket" tmux -f /dev/null kill-server
|
||||
# rm -rf "$probe_socket"
|
||||
# printf '%s\n' "$discovered_plugins"
|
||||
# )
|
||||
#
|
||||
# tpm_plugins=$(tmux show -gvq '@tpm_plugins' 2>/dev/null)
|
||||
# if [ -z "$(tmux show -gv '@plugin' 2>/dev/null)" ] && [ -z "$tpm_plugins" ]; then
|
||||
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }'
|
||||
# $tpm_plugins
|
||||
# $(__discover_plugins "$TMUX_CONF_LOCAL")
|
||||
# EOF
|
||||
# )
|
||||
# if [ -z "$tpm_plugins" ]; then
|
||||
# if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
||||
# tmux display 'Uninstalling tpm and plugins...'
|
||||
# tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH
|
||||
|
@ -1572,11 +1671,6 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# fi
|
||||
# else
|
||||
# if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$("$TMUX_PROGRAM" display -p '#{pid} #{version} #{socket_path}')" ]; then
|
||||
# tpm_plugins=$(cat << EOF | tr ' ' '\n' | awk '/^\s*$/ {next;}; !seen[$0]++ { gsub(/^[ \t]+/,"",$0); gsub(/[ \t]+$/,"",$0); print $0 }'
|
||||
# $tpm_plugins
|
||||
# $(awk '/^[ \t]*set(-option)?.*[ \t]@plugin[ \t]/ { gsub(/'\''/, ""); gsub(/'\"'/, ""); print $NF }' "$TMUX_CONF_LOCAL" 2>/dev/null)
|
||||
# EOF
|
||||
# )
|
||||
# tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
|
||||
# tmux set -g '@tpm_plugins' "$tpm_plugins"
|
||||
#
|
||||
|
@ -1606,14 +1700,14 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# if [ "$update_tpm" = "true" ]; then
|
||||
# {
|
||||
# {
|
||||
# printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf 'Done.\n' | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins all" | _timestamp
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/update_plugins" all 2>&1 | _timestamp
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins all" | _timestamp
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/clean_plugins" all 2>&1 | _timestamp
|
||||
# printf 'Done.\n' | _timestamp
|
||||
# printf '\n'
|
||||
# } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt"
|
||||
#
|
||||
|
@ -1622,10 +1716,10 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# elif [ "$install_tpm" = "true" ]; then
|
||||
# {
|
||||
# {
|
||||
# printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf 'Done.\n' | perl -MPOSIX=strftime -MTime::HiRes=gettimeofday -pe 'my ($s, $us) = gettimeofday(); printf ("[%s.%03d]\t ", strftime("%Y-%m-%d %H:%M:%S", localtime $s), $us / 1000)'
|
||||
# printf 'List of discovered tpm plugins: %s\n' "$(printf '%s\n' "$tpm_plugins" | paste -s -d ' ' -)" | _timestamp
|
||||
# printf '%s\n' "Invoking $TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" | _timestamp
|
||||
# "$TMUX_PLUGIN_MANAGER_PATH/tpm/bin/install_plugins" 2>&1 | _timestamp
|
||||
# printf 'Done.\n' | _timestamp
|
||||
# printf '\n' >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt"
|
||||
# } >> "$TMUX_PLUGIN_MANAGER_PATH/tpm_log.txt"
|
||||
#
|
||||
|
@ -1641,7 +1735,11 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# tmux display "GitHub doesn't seem to be reachable, skipping installing and/or updating tpm and plugins..."
|
||||
# fi
|
||||
# else
|
||||
# tmux run -b "sleep \$((#{display-time} / 1000)) && '$TMUX_PROGRAM' set display-time 3000 \; display 'Cannot use tpm which assumes a globally installed tmux' \; set -u display-time"
|
||||
# if [ "$_tmux_version" -ge 3200 ]; then
|
||||
# tmux run -b "exec sh -c 'sleep \$((#{display-time} / 1000)) && \"$TMUX_PROGRAM\" display -N -d 3000 \"Cannot use tpm which assumes a globally installed tmux\"'"
|
||||
# else
|
||||
# tmux run -b "exec sh -c 'sleep \$((#{display-time} / 1000)) && \"$TMUX_PROGRAM\" set display-time 3000 \; display \"Cannot use tpm which assumes a globally installed tmux\" \; set -u display-time'"
|
||||
# fi
|
||||
# fi
|
||||
#
|
||||
# if [ "$_tmux_version" -gt 2600 ]; then
|
||||
|
@ -1686,26 +1784,25 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
|||
# _apply_configuration() {
|
||||
# window_active="$(tmux display -p '#{window_active}' 2>/dev/null || true)"
|
||||
# if [ -z "$window_active" ]; then
|
||||
# if ! command -v perl > /dev/null 2>&1; then
|
||||
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl" \; set -u display-time \; run "sleep 3" \; kill-server'
|
||||
# return
|
||||
# fi
|
||||
# if ! perl -MTime::HiRes -e1 > /dev/null 2>&1; then
|
||||
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires perl Time::HiRes" \; set -u display-time \; run "sleep 3" \; kill-server'
|
||||
# return
|
||||
# fi
|
||||
# if ! command -v sed > /dev/null 2>&1; then
|
||||
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires sed" \; set -u display-time \; run "sleep 3" \; kill-server'
|
||||
# return
|
||||
# fi
|
||||
# if ! command -v awk > /dev/null 2>&1; then
|
||||
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires awk" \; set -u display-time \; run "sleep 3" \; kill-server'
|
||||
# return
|
||||
# fi
|
||||
# if [ "$_tmux_version" -lt 2600 ]; then
|
||||
# tmux run -b 'tmux set display-time 3000 \; display "This configuration requires tmux 2.6+" \; set -u display-time \; run "sleep 3" \; kill-server'
|
||||
# return
|
||||
# fi
|
||||
# if [ "$_tmux_version" -ge 3200 ]; then
|
||||
# for cmd in perl sed awk; do
|
||||
# if ! command -v "$cmd" > /dev/null 2>&1; then
|
||||
# tmux run -b "tmux display -N -d 3000 'This configuration requires $cmd' \; run 'sleep 3' \; kill-server"
|
||||
# return
|
||||
# fi
|
||||
# done
|
||||
# else
|
||||
# for cmd in perl sed awk; do
|
||||
# if ! command -v "$cmd" > /dev/null 2>&1; then
|
||||
# tmux run -b "tmux set display-time 3000 \; display 'This configuration requires $cmd' \; set -u display-time \; run 'sleep 3' \; kill-server"
|
||||
# return
|
||||
# fi
|
||||
# done
|
||||
# fi
|
||||
# fi
|
||||
#
|
||||
# case "$_uname_s" in
|
||||
|
|
|
@ -268,6 +268,7 @@ tmux_conf_theme_right_separator_sub="|"
|
|||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} "
|
||||
#tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} | #{pretty_pane_current_path} "
|
||||
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} "
|
||||
|
||||
# status left style
|
||||
|
|
|
@ -54,12 +54,12 @@ you're on your own. Instead, every customization should happen in your
|
|||
If you're a Vim user, setting the `$EDITOR` environment variable to `vim` will
|
||||
enable and further customize the vi-style key bindings (see tmux manual).
|
||||
|
||||
If you're new to tmux, I recommend you to read [tmux 2: Productive Mouse-Free
|
||||
Development][bhtmux2] by [@bphogan].
|
||||
If you're new to tmux, I recommend you to read [tmux 3: Productive Mouse-Free
|
||||
Development][bhtmux3] by [@bphogan].
|
||||
|
||||
Now proceed to [adjust] your `.local` customization file copy.
|
||||
|
||||
[bhtmux2]: https://pragprog.com/titles/bhtmux2/tmux-2
|
||||
[bhtmux3]: https://pragprog.com/titles/bhtmux3/tmux-3/
|
||||
[@bphogan]: https://twitter.com/bphogan
|
||||
[adjust]: #configuration
|
||||
|
||||
|
@ -277,6 +277,8 @@ This configuration supports the following builtin variables:
|
|||
connected to a remote server through SSH/Mosh
|
||||
- `#{loadavg}`: load average
|
||||
- `#{pairing}`: is session attached to more than one client?
|
||||
- `#{pretty_pane_current_path}`: prettified `#{pane_current_path}` when its
|
||||
length is too long
|
||||
- `#{prefix}`: is prefix being depressed?
|
||||
- `#{root}`: is current user root?
|
||||
- `#{synchronized}`: are the panes synchronized?
|
||||
|
|
Loading…
Add table
Reference in a new issue