mirror of
1
0
Fork 0

Merge pull request #1 from gpakosz/master

Pulling in from base fork original repo
This commit is contained in:
tnory56 2019-09-16 10:33:11 -04:00 committed by GitHub
commit 8a1d1ad816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 214 additions and 119 deletions

7
.gitattributes vendored Normal file
View File

@ -0,0 +1,7 @@
* text=auto
# git
.gitignore text
.tmux.conf eol=lf
.tmux.conf.local eol=lf

View File

@ -143,7 +143,8 @@ 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"'
@ -168,6 +169,7 @@ if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
# -- 8< ------------------------------------------------------------------------
run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
run -b '[ -z "#{session_id}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true'
# EOF
@ -175,8 +177,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='
# '
#
@ -184,7 +196,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 ))
@ -195,11 +207,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
@ -238,6 +268,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# }
#
# _battery() {
# count=0
# charge=0
# uname_s=$(uname -s)
# case "$uname_s" in
@ -302,7 +333,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' \;\
@ -454,60 +485,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 '\
# { \
@ -522,7 +584,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# fi
#
# echo "$hostname"
# printf '%s' "$hostname"
# }
#
# _root() {
@ -543,6 +605,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*)
@ -553,12 +616,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)
@ -582,19 +649,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() {
@ -626,7 +696,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}
@ -634,13 +704,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}
@ -648,13 +718,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}
@ -668,7 +738,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}
@ -682,10 +752,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
@ -693,11 +763,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
@ -748,10 +818,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
@ -778,13 +848,13 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# 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_digit #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \
# -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 "$tmux_conf_theme_terminal_title"
# 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
@ -796,30 +866,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 \
# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \
# -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_digit #I)%g' \
# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \
# -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'}
@ -1052,14 +1122,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
@ -1080,14 +1150,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')
@ -1105,11 +1179,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 -------------------------------------------------------------
#
@ -1137,7 +1211,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() {

View File

@ -150,10 +150,10 @@ tmux_conf_theme_left_separator_main=''
tmux_conf_theme_left_separator_sub='|'
tmux_conf_theme_right_separator_main=''
tmux_conf_theme_right_separator_sub='|'
#tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline
#tmux_conf_theme_left_separator_sub='' # you only need fonts patched with
#tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone
#tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font
#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
# status left/right content:
# - separate main sections with '|'
@ -172,13 +172,14 @@ tmux_conf_theme_right_separator_sub='|'
# - #{prefix}
# - #{root}
# - #{synchronized}
# - #{uptime_d}
# - #{uptime_y}
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
# - #{uptime_h}
# - #{uptime_m}
# - #{uptime_s}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_status_left=' ❐ #S | ↑#{?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,} '
tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
# status left style
@ -254,7 +255,8 @@ tmux_conf_battery_status_discharging='↓' # U+2193
#tmux_conf_battery_status_charging='🔌 ' # U+1F50C
#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
# clock style
# clock style (when you hit <prefix> + t)
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
tmux_conf_theme_clock_colour='#00afff' # light blue
tmux_conf_theme_clock_style='24'

View File

@ -32,7 +32,7 @@ Then proceed to [customize] your `~/.tmux.conf.local` copy.
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 recommmend you read [tmux 2: Productive Mouse-Free
If you're new to tmux, I recommend you read [tmux 2: Productive Mouse-Free
Development][bhtmux2] by [@bphogan].
[bhtmux2]: https://pragprog.com/book/bhtmux2/tmux-2
@ -93,7 +93,7 @@ Features
- `C-a` acts as secondary prefix, while keeping default `C-b` prefix
- visual theme inspired by [Powerline][]
- [maximize any pane to a new window with `<prefix> +`][maximize-pane]
- SSH aware username and hostname status line information
- SSH/Mosh aware username and hostname status line information
- mouse mode toggle with `<prefix> m`
- automatic usage of [`reattach-to-user-namespace`][reattach-to-user-namespace]
if available
@ -101,9 +101,10 @@ Features
- uptime status line information
- optional highlight of focused pane (tmux `>= 2.1`)
- configurable new windows and panes behavior (optionally retain current path)
- SSH aware split pane (reconnects to remote server, experimental)
- SSH/Mosh aware split pane (reconnects to remote server)
- copy to OS clipboard (needs [`reattach-to-user-namespace`][reattach-to-user-namespace]
on macOS, `xsel` or `xclip` on Linux)
- support for 4-digit hexadecimal Unicode characters (requires `perl` or Bash >= 4.1.2)
- [Facebook PathPicker][] integration if available
- [Urlview][] integration if available
@ -208,15 +209,13 @@ To make use of these symbols, there are several options:
- use a [pre-patched font][powerline patched fonts]
- use your preferred font along with the [Powerline font][powerline font] (that
only contains the Powerline symbols): [this highly depends on your operating
system and your terminal emulator][terminal support]
- [patch your preferred font][powerline font patcher] by adding the missing
Powerline symbols: this is the most difficult way and is no more documented in
the [Powerline manual]
system and your terminal emulator][terminal support], for instance here's a
screenshot of iTerm2 configured to use `PowerlineSymbols.otf`
![iTerm2 + Powerline font](https://user-images.githubusercontent.com/553208/62243890-8232f500-b3de-11e9-9b8c-51a5d38bdaa8.png)
[source code pro]: https://github.com/adobe-fonts/source-code-pro/releases/tag/2.030R-ro/1.050R-it
[powerline patched fonts]: https://github.com/powerline/fonts
[powerline font]: https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
[powerline font patcher]: https://github.com/powerline/fontpatcher
[terminal support]: http://powerline.readthedocs.io/en/master/usage.html#usage-terminal-emulators
[Powerline manual]: http://powerline.readthedocs.org/en/latest/installation.html#fonts-installation
@ -226,10 +225,10 @@ Then edit the `~/.tmux.conf.local` file (`<prefix> e`) and adjust the following
variables:
```
tmux_conf_theme_left_separator_main=''
tmux_conf_theme_left_separator_sub=''
tmux_conf_theme_right_separator_main=''
tmux_conf_theme_right_separator_sub=''
tmux_conf_theme_left_separator_main='\uE0B0'
tmux_conf_theme_left_separator_sub='\uE0B1'
tmux_conf_theme_right_separator_main='\uE0B2'
tmux_conf_theme_right_separator_sub='\uE0B3'
```
### Configuring the status line
@ -247,21 +246,34 @@ This configuration supports the following builtin variables:
- `#{battery_status}`: is battery charging or discharging?
- `#{battery_vbar}`: vertical battery charge bar
- `#{circled_session_name}`: circled session number, up to 20
- `#{hostname}`: SSH aware hostname information
- `#{hostname_ssh}`: SSH aware hostname information, blank when no SSH
connection detected
- `#{hostname}`: SSH/Mosh aware hostname information
- `#{hostname_ssh}`: SSH/Mosh aware hostname information, blank when not
connected to a remote server through SSH/Mosh
- `#{loadavg}`: load average
- `#{pairing}`: is session attached to more than one client?
- `#{prefix}`: is prefix being depressed?
- `#{root}`: is current user root?
- `#{synchronized}`: are the panes synchronized?
- `#{uptime_d}`: uptime days
- `#{uptime_y}`: uptime years
- `#{uptime_d}`: uptime days, modulo 365 when `#{uptime_y}` is used
- `#{uptime_h}`: uptime hours
- `#{uptime_m}`: uptime minutes
- `#{uptime_s}`: uptime seconds
- `#{username}`: SSH aware username information
- `#{username_ssh}`: SSH aware username information, blank when no SSH
connection detected
- `#{username}`: SSH/Mosh aware username information
- `#{username_ssh}`: SSH aware username information, blank when not connected
to a remote server through SSH/Mosh
Beside custom variables mentioned above, the `tmux_conf_theme_status_left` and
`tmux_conf_theme_status_right` variables support usual tmux syntax, e.g. using
`#()` to call an external command that inserts weather information provided by
[wttr.in]:
```
tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #(curl wttr.in?format=3) , %R , %d %b | #{username}#{root} | #{hostname} '
```
![Weather information from wttr.in](https://user-images.githubusercontent.com/553208/52175490-07797c00-27a5-11e9-9fb6-42eec4fe4188.png)
[wttr.in]: https://github.com/chubin/wttr.in#one-line-output
### Accessing the macOS clipboard from within tmux sessions