abra at Fri Aug 9 21:33:04 +04 2019

This commit is contained in:
2019-08-09 21:33:04 +04:00
parent 7bd08705dd
commit 85d1e16c0b
3 changed files with 260 additions and 118 deletions

View File

@@ -32,14 +32,13 @@ bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g set-titles-string '#h ❐ #S ● #I #W'
set -g set-titles on # set terminal title
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
@@ -87,13 +86,8 @@ bind -r L resize-pane -R 2
# window navigation
unbind n
unbind p
# bind -r C-h previous-window # select previous window
# bind -r C-l next-window # select next window
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# toggle mouse
@@ -144,9 +138,12 @@ run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/nu
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to Mac OSX clipboard
# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
@@ -178,8 +175,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# # exit the script if any statement returns a non-true return value
# set -e
#
# unset GREP_OPTIONS
# export LC_NUMERIC=C
#
# if ! printf '' | sed -E 's///' 2>/dev/null; then
# if printf '' | sed -r 's///' 2>/dev/null; then
# sed () {
# n=$#; while [ "$n" -gt 0 ]; do arg=$1; shift; case $arg in -E*) arg=-r${arg#-E};; esac; set -- "$@" "$arg"; n=$(( n - 1 )); done
# command sed "$@"
# }
# fi
# fi
#
# __newline='
# '
#
@@ -187,7 +194,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ( ([ x"$1" = x"enabled" ] || [ x"$1" = x"true" ] || [ x"$1" = x"yes" ] || [ x"$1" = x"1" ]) && return 0 ) || return 1
# }
#
# _circled_digit() {
# _circled() {
# circled_digits='⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳'
# if [ "$1" -le 20 ] 2>/dev/null; then
# i=$(( $1 + 1 ))
@@ -198,11 +205,29 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# }
#
# if command -v perl > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# 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
# }
# elif bash --norc --noprofile -c '[[ ! $BASH_VERSION < 4.2. ]]' > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# bash --norc --noprofile -c "printf '%b' '$*'"
# }
# elif command -v python > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# python -c "import re; import sys; sys.stdout.write(re.sub(r'\\\U([0-9A-Fa-f]{1,8})', lambda match: r'\U%s' % match.group(1).zfill(8), r'$*').encode().decode('unicode-escape', 'ignore'))"
# }
# else
# _decode_unicode_escapes() {
# printf '%b' "$*"
# }
# fi
#
# _maximize_pane() {
# current_session=${1:-$(tmux display -p '#{session_name}')}
# current_pane=${2:-$(tmux display -p '#{pane_id}')}
#
# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true)
# dead_panes=$(tmux list-panes -s -t "$current_session" -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -E -o '^1 %.+maximized.+$' || true)
# restore=$(echo "$dead_panes" | sed -n -E -e "s/^1 $current_pane .+maximized.+'(%[0-9]+)'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t $current_pane/p" -e "s/^1 (%[0-9]+) .+maximized.+'$current_pane'$/tmux swap-pane -s \1 -t $current_pane \; kill-pane -t \1/p" )
#
# if [ -z "$restore" ]; then
@@ -210,12 +235,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# window=$(tmux new-window -t "$current_session:" -P "exec maximized... 2> /dev/null & tmux setw -t \"$current_session:\" remain-on-exit on; printf \"Pane has been maximized, press <prefix>+ to restore. %s\" '$current_pane'")
# window=${window%.*}
#
# guard=10
# while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$guard" -ne 0 ]; do
# sleep 0.01
# guard=$((guard - 1))
# retry=10
# while [ x"$(tmux list-panes -t "$window" -F '#{session_name}:#{window_index} #{pane_dead}' 2>/dev/null)" != x"$window 1" ] && [ "$retry" -ne 0 ]; do
# sleep 0.05
# retry=$((retry - 1))
# done
# if [ "$guard" -eq 0 ]; then
# if [ "$retry" -eq 0 ]; then
# tmux display 'Unable to maximize pane'
# fi
#
@@ -241,6 +266,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _battery() {
# count=0
# charge=0
# uname_s=$(uname -s)
# case "$uname_s" in
@@ -258,6 +284,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ;;
# *Linux*)
# while IFS= read -r batpath; do
# grep -i -q device "$batpath/scope" 2> /dev/null && continue
#
# if [ x"$discharging" != x"true" ]; then
# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")
# fi
@@ -303,7 +331,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# done
# ;;
# esac
# charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }')
# [ "$count" -ne 0 ] && charge=$(awk -v charge="$charge" -v count="$count" 'BEGIN { print charge / count }')
# if [ "$charge" -eq 0 ]; then
# tmux set -ug '@battery_status' \;\
# set -ug '@battery_bar' \;\
@@ -455,60 +483,91 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# set -g '@battery_percentage' "$battery_percentage"
# }
#
# _tty_info() {
# tty="${1##/dev/}"
# uname -s | grep -q "CYGWIN" && cygwin=true
#
# if [ x"$cygwin" = x"true" ]; then
# ps -af | tail -n +2 | awk -v tty="$tty" '
# ((/ssh/ && !/-W/) || !/ssh/) && $4 == tty {
# user[$2] = $1; parent[$2] = $3; child[$3] = $2
# }
# END {
# for (i in user)
# {
# if (!(i in child) && parent[i] != 1)
# {
# file = "/proc/" i "/cmdline"; getline command < file; close(file)
# gsub(/\0/, " ", command)
# print i, user[i], command
# exit
# }
# }
# }
# '
# else
# ps -t "$tty" -o user=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -o pid= -o ppid= -o command= | awk '
# NR > 1 && ((/ssh/ && !/-W/) || !/ssh/) {
# user[$2] = $1; parent[$2] = $3; child[$3] = $2; for (i = 4 ; i <= NF; ++i) command[$2] = i > 4 ? command[$2] FS $i : $i
# }
# END {
# for (i in parent)
# {
# if (!(i in child) && parent[i] != 1)
# {
# print i, user[i], command[i]
# exit
# }
# }
# }
# '
# fi
# }
#
# _ssh_or_mosh_args() {
# args=$(printf '%s' "$1" | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
# if [ -z "$args" ]; then
# args=$(printf '%s' "$1" | grep 'mosh-client' | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/' -e 's/-[^ ]*//g' -e 's/\d:\d//g')
# fi
#
# printf '%s' "$args"
# }
#
# _username() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# ssh_only=$2
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }')
# [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //')
# else
# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
# fi
# if [ -n "$ssh_parameters" ]; then
#
# tty_info=$(_tty_info "$tty")
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
#
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
# if [ -n "$ssh_or_mosh_args" ]; then
# # shellcheck disable=SC2086
# username=$(ssh -G $ssh_parameters 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }')
# username=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^user / { print $2 }')
# # shellcheck disable=SC2086
# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_parameters 2>&1 | awk '/^%username% / { print $2; exit }')
# [ -z "$username" ] && username=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%username%% %r >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%username% / { print $2; exit }')
# else
# if ! _is_enabled "$ssh_only"; then
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# username=$(whoami)
# else
# username=$(ps -t "$tty" -o user= -o pid= -o ppid= -o command= | awk '
# !/ssh/ { user[$2] = $1; ppid[$3] = 1 }
# END {
# for (i in user)
# if (!(i in ppid))
# {
# print user[i]
# exit
# }
# }
# ')
# fi
# username=$(printf '%s' "$tty_info" | cut -d' ' -f2)
# fi
# fi
#
# echo "$username"
# printf '%s' "$username"
# }
#
# _hostname() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# ssh_only=$2
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }')
# [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //')
# else
# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }')
# fi
# if [ -n "$ssh_parameters" ]; then
#
# tty_info=$(_tty_info "$tty")
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
#
# ssh_or_mosh_args=$(_ssh_or_mosh_args "$command")
# if [ -n "$ssh_or_mosh_args" ]; then
# # shellcheck disable=SC2086
# hostname=$(ssh -G $ssh_parameters 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }')
# hostname=$(ssh -G $ssh_or_mosh_args 2>/dev/null | awk 'NR > 2 { exit } ; /^hostname / { print $2 }')
# # shellcheck disable=SC2086
# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_parameters 2>&1 | awk '/^%hostname% / { print $2; exit }')
# [ -z "$hostname" ] && hostname=$(ssh -T -o ControlPath=none -o ProxyCommand="sh -c 'echo %%hostname%% %h >&2'" $ssh_or_mosh_args 2>&1 | awk '/^%hostname% / { print $2; exit }')
# #shellcheck disable=SC1004
# hostname=$(echo "$hostname" | awk '\
# { \
@@ -523,7 +582,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# fi
#
# echo "$hostname"
# printf '%s' "$hostname"
# }
#
# _root() {
@@ -544,6 +603,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# now=$(date +%s)
# ;;
# *Linux*|*CYGWIN*|*MSYS*|*MINGW*)
# boot=0
# now=$(cut -d' ' -f1 < /proc/uptime)
# ;;
# *OpenBSD*)
@@ -554,12 +614,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# awk -v boot="$boot" -v now="$now" '
# BEGIN {
# uptime = now - boot
# y = int(uptime / 31536000)
# dy = int(uptime / 86400) % 365
# d = int(uptime / 86400)
# h = int(uptime / 3600) % 24
# m = int(uptime / 60) % 60
# s = int(uptime) % 60
#
# system("tmux set -g @uptime_d " d + 0 " \\; " \
# system("tmux set -g @uptime_y " y + 0 " \\; " \
# "set -g @uptime_dy " dy + 0 " \\; " \
# "set -g @uptime_d " d + 0 " \\; " \
# "set -g @uptime_h " h + 0 " \\; " \
# "set -g @uptime_m " m + 0 " \\; " \
# "set -g @uptime_s " s + 0)
@@ -583,19 +647,22 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _split_window() {
# tty=${1:-$(tmux display -p '#{pane_tty}')}
# shift
# # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then
# pid=$(ps -a | sort -d | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/-W/ { print $1; exit 0 }')
# [ -n "$pid" ] && ssh=$(tr '\0' ' ' < "/proc/$pid/cmdline")
# else
# ssh=$(ps -t "$tty" -o command= | sort -d | awk '/ssh/ && !/-W/ { print $0; exit 0 }')
# fi
# if [ -n "$ssh" ]; then
# # shellcheck disable=SC2046
# tmux split-window "$@" $(echo "$ssh" | sed -e "s/;/\\\\;/g")
# else
# tmux split-window "$@"
# fi
#
# tty_info=$(_tty_info "$tty")
# command=$(printf '%s' "$tty_info" | cut -d' ' -f3-)
#
# case "$command" in
# *mosh-client*)
# # shellcheck disable=SC2046
# tmux split-window "$@" mosh $(echo "$command" | sed -E -e 's/.*mosh-client -# (.*)\|.*$/\1/')
# ;;
# *ssh*)
# # shellcheck disable=SC2046
# tmux split-window "$@" $(echo "$command" | sed -e 's/;/\\;/g')
# ;;
# *)
# tmux split-window "$@"
# esac
# }
#
# _apply_overrides() {
@@ -605,7 +672,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# screen-*|tmux-*)
# ;;
# *)
# tmux set-option -ga terminal-overrides ",$TERM:Tc"
# tmux set-option -ga terminal-overrides ",*256col*:Tc"
# ;;
# esac
# fi
@@ -627,7 +694,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-window\(\s\+-c\s\+"#{pane_current_path}\|$\)')
# $(tmux list-keys 2>/dev/null | grep -E 'new-window(\s+-c\s+"#{pane_current_path}"|$)')
# EOF
#
# tmux_conf_new_pane_retain_current_path=${tmux_conf_new_pane_retain_current_path:-true}
@@ -635,13 +702,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# [ -z "$line" ] && continue
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_pane_retain_current_path"; then
# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/split-window([ \t]+-(h|v))?$/& -c "#{pane_current_path}"/g')
# right=$(printf '%s' "$line" | cut -c"$column-" | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e '/#\{pane_current_path\}/!s/split(-|_)window([ \t]+#\{pane_tty\})?([ \t]+-(h|v))?/& -c "#{pane_current_path}"/g')
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/-c[ \t]+"#\{pane_current_path\}"$//g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/[ \t]+(-c[ \t]+(\\")?"#\{pane_current_path\}"(\\")?|-c #\{pane_current_path\})//g')
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# $(tmux list-keys 2>/dev/null | grep -E 'split(-|_)window')
# EOF
#
# tmux_conf_new_pane_reconnect_ssh=${tmux_conf_new_pane_reconnect_ssh:-false}
@@ -649,13 +716,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# [ -z "$line" ] && continue
# left=$(printf '%s' "$line" | cut -c-"$column" | sed -E -e 's/[^ \ta-zA-Z0-9,._+@%/-]/\\&/g')
# if _is_enabled "$tmux_conf_new_pane_reconnect_ssh"; then
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/"/\\"/g' -e 's/split-window([^;]+)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e '/_split_window/!s/"/\\"/g' -e 's/split-window([^;]*)/run-shell "cut -c3- ~\/\.tmux\.conf | sh -s _split_window #{pane_tty}\1"/g')
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/\\"/"/g' -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]+)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g')
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e 's/\\"/"/g' -e 's/run-shell "cut -c3- ~\/\.tmux\.conf \| sh -s _split_window #\{pane_tty\}([^;]*)"/split-window\1/g' -e 's/#\{.+\}/\"&\"/g')
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'split\(-\|_\)window')
# $(tmux list-keys 2>/dev/null | grep -E 'split(-|_)window')
# EOF
#
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
@@ -669,7 +736,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys 2>/dev/null | grep -e 'new-session')
# $(tmux list-keys 2>/dev/null | grep 'new-session')
# EOF
#
# tmux_conf_copy_to_os_clipboard=${tmux_conf_copy_to_os_clipboard:-false}
@@ -683,10 +750,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# if [ -n "$command" ]; then
# # shellcheck disable=SC2086
# for table in "" "-t emacs-copy" "-t vi-copy"; do
# line=$(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe' | head -1)
# line=$(tmux list-keys $table 2>/dev/null | grep -E 'copy-selection|copy-pipe' | head -1)
# [ -z "$line" ] && continue
# prefix=${line%copy-*}
# column=${#prefix}
# [ -z "$line" ] && continue
#
# while IFS= read -r line; do
# [ -z "$line" ] && continue
@@ -694,11 +761,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-selection(-and-cancel)?$/copy-pipe\1 \"$command\"/g")
# else
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"$command\"$/copy-selection\1/g")
# right=$(printf '%s' "$line" | cut -c"$column"- | awk -F'\"' 'BEGIN { OFS = FS } { for (i = 1; i <= NF; i+=2) { gsub(/#{.+}/, "\"&\"", $i) } print }' | sed -E -e "s/copy-pipe(-and-cancel)? \"?$command\"?$/copy-selection\1/g")
# fi
# eval "tmux $left $right" 2>/dev/null || true
# done << EOF
# $(tmux list-keys $table 2>/dev/null | grep -e 'copy-selection\|copy-pipe')
# $(tmux list-keys $table 2>/dev/null | grep -E 'copy-selection|copy-pipe')
# EOF
# done
# fi
@@ -749,10 +816,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
#
# # -- status line -------------------------------------------------------
#
# tmux_conf_theme_left_separator_main=${tmux_conf_theme_left_separator_main-''}
# tmux_conf_theme_left_separator_sub=${tmux_conf_theme_left_separator_sub-'|'}
# tmux_conf_theme_right_separator_main=${tmux_conf_theme_right_separator_main-''}
# tmux_conf_theme_right_separator_sub=${tmux_conf_theme_right_separator_sub-'|'}
# tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-''}")
# tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-'|'}")
# tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-''}")
# tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-'|'}")
#
# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-'#000000'} # black
# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-'#ffff00'} # yellow
@@ -776,6 +843,17 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# set -g status-left-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr" \;\
# set -g status-right-style "fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg,$tmux_conf_theme_status_attr"
#
# tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-'#h ❐ #S ● #I #W'}
#
# tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | 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%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
# tmux set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")"
#
# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white
# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-'#080808'} # dark gray
# tmux_conf_theme_window_status_attr=${tmux_conf_theme_window_status_attr:-'none'}
@@ -786,18 +864,30 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-'bold'}
# tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-'#I #W'}
# if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_window_status_bg]$tmux_conf_theme_right_separator_main#[fg=default,bg=default,default] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main"
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_window_status_bg]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main"
# else
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$tmux_conf_theme_left_separator_main#[fg=default,bg=default,default] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_left_separator_main"
# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_left_separator_main"
# fi
#
# tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g')
# tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g')
# tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_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%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
# tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_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%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
#
# tmux setw -g window-status-style "fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr" \;\
# setw -g window-status-format "$tmux_conf_theme_window_status_format" \;\
# setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\
# setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\
# setw -g window-status-current-format "$tmux_conf_theme_window_status_current_format"
# setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")"
#
# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-'default'}
# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-'default'}
@@ -831,6 +921,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-'none'}
# tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-'bold,blink'}
#
# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-'🔒'} # U+1F512
# tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-'none'}
# tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-'none'}
# tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-'none'}
#
# # -- status left style
#
# tmux_conf_theme_status_left=${tmux_conf_theme_status_left-' ❐ #S '}
@@ -847,6 +942,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g")
#
# tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \
# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g")
#
# if [ -n "$tmux_conf_theme_status_left" ]; then
# status_left=$(awk \
# -v fg_="$tmux_conf_theme_status_left_fg" \
@@ -931,6 +1029,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g")
#
# tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \
# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g")
#
# if [ -n "$tmux_conf_theme_status_right" ]; then
# status_right=$(awk \
# -v fg_="$tmux_conf_theme_status_right_fg" \
@@ -1019,14 +1120,14 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
#
# tmux set -g '@battery_bar_symbol_full' "$tmux_conf_battery_bar_symbol_full" \;\
# set -g '@battery_bar_symbol_empty' "$tmux_conf_battery_bar_symbol_empty" \;\
# tmux set -g '@battery_bar_symbol_full' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_full")" \;\
# set -g '@battery_bar_symbol_empty' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_empty")" \;\
# set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\
# set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\
# set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\
# set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\
# set -g '@battery_status_charging' "$tmux_conf_battery_status_charging" \;\
# set -g '@battery_status_discharging' "$tmux_conf_battery_status_discharging"
# set -g '@battery_status_charging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_charging")" \;\
# set -g '@battery_status_discharging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_discharging")"
# status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right"
# ;;
# esac
@@ -1047,14 +1148,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# esac
#
# case "$status_left $status_right" in
# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*)
# *'#{uptime_d}'*|*'#{uptime_h}'*|*'#{uptime_m}'*|*'#{uptime_s}'*)
# status_left=$(echo "$status_left" | sed -E \
# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
# status_right=$(echo "$status_right" | sed -E \
# -e 's/#\{(\?)?uptime_y/#\{\1@uptime_y/g' \
# -e 's/#\{(\?)?uptime_d/#\{\1@uptime_d/g' \
# -e '/@uptime_y/ s/@uptime_d/@uptime_dy/g' \
# -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \
# -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \
# -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g')
@@ -1072,11 +1177,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ;;
# esac
#
# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g')
# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g')
# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
#
# tmux set -g status-left-length 1000 \; set -g status-left "$status_left" \;\
# set -g status-right-length 1000 \; set -g status-right "$status_right"
# tmux set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\
# set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")"
#
# # -- clock -------------------------------------------------------------
#
@@ -1104,7 +1209,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# _apply_overrides
# _apply_bindings
# _apply_theme
# for name in $(printenv | grep -Eo '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done;
# for name in $(printenv | grep -E -o '^tmux_conf_[^=]+'); do tmux setenv -gu "$name"; done;
# }
#
# _urlview() {