Compare commits
5 commits
b130d0aa31
...
edc4a9901c
Author | SHA1 | Date | |
---|---|---|---|
|
edc4a9901c | ||
|
2e419db5d9 | ||
|
6e22cc2965 | ||
|
5fcc377128 | ||
|
b1f66acae3 |
2 changed files with 72 additions and 19 deletions
85
.tmux.conf
85
.tmux.conf
|
@ -63,9 +63,13 @@ set -g visual-activity off
|
||||||
|
|
||||||
|
|
||||||
# -- navigation ----------------------------------------------------------------
|
# -- navigation ----------------------------------------------------------------
|
||||||
|
These two settings let you create/kill a new session when pressing Prefix S (Shift+s) or Prefix K (Shift+k) respectively:
|
||||||
|
|
||||||
# create session
|
# create session
|
||||||
bind C-c new-session
|
bind C-s command-prompt -p "New Session:" "new-session -A -s '%%'"
|
||||||
|
|
||||||
|
# kill session
|
||||||
|
bind K confirm kill-session
|
||||||
|
|
||||||
# find session
|
# find session
|
||||||
bind C-f command-prompt -p find-session 'switch-client -t %%'
|
bind C-f command-prompt -p find-session 'switch-client -t %%'
|
||||||
|
@ -164,6 +168,8 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# # exit the script if any statement returns a non-true return value
|
# # exit the script if any statement returns a non-true return value
|
||||||
# set -e
|
# set -e
|
||||||
#
|
#
|
||||||
|
# unset SHELL
|
||||||
|
#
|
||||||
# unset GREP_OPTIONS
|
# unset GREP_OPTIONS
|
||||||
# export LC_NUMERIC=C
|
# export LC_NUMERIC=C
|
||||||
# # shellcheck disable=SC3041
|
# # shellcheck disable=SC3041
|
||||||
|
@ -189,7 +195,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# if [ -z "$TMUX_PROGRAM" ]; then
|
# if [ -z "$TMUX_PROGRAM" ]; then
|
||||||
# TMUX_PID=$(printf '%s' "$TMUX" | cut -d, -f2)
|
# 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; {" 2>/dev/null || readlink "/proc/$TMUX_PID/exe" 2>/dev/null)
|
# 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)
|
||||||
# [ x"$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = x"$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux)
|
# [ "$("$TMUX_PROGRAM" -S "$TMUX_SOCKET" display -p '#{pid}' 2>/dev/null)" = "$TMUX_PID" ] || TMUX_PROGRAM=$(command -v tmux || printf tmux)
|
||||||
# fi
|
# fi
|
||||||
# if [ "$TMUX_PROGRAM" = "tmux" ]; then
|
# if [ "$TMUX_PROGRAM" = "tmux" ]; then
|
||||||
# tmux() {
|
# tmux() {
|
||||||
|
@ -603,7 +609,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# battery_status="$battery_status_charging"
|
# battery_status="$battery_status_charging"
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
# tmux set -g '@battery_status' "$battery_status"
|
# tmux set -g '@battery_status' "$battery_status" >/dev/null 2>/dev/null
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# _pane_info() {
|
# _pane_info() {
|
||||||
|
@ -611,14 +617,18 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# pane_tty="${2##/dev/}"
|
# pane_tty="${2##/dev/}"
|
||||||
# case "$_uname_s" in
|
# case "$_uname_s" in
|
||||||
# *CYGWIN*)
|
# *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 {
|
# ((/ssh/ && !/-W/ && !/tsh proxy ssh/ &!/sss_ssh_knownhostsproxy/) || !/ssh/) && !/tee/ && $5 == tty {
|
||||||
# user[$1] = $6; if (!child[$2]) child[$2] = $1
|
# user[$1] = $6; if (!child[$2]) child[$2] = $1
|
||||||
# }
|
# }
|
||||||
# END {
|
# END {
|
||||||
# pid = pane_pid
|
# pid = pane_pid
|
||||||
# while (child[pid])
|
# while (child[pid]) {
|
||||||
|
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
# pid = child[pid]
|
# pid = child[pid]
|
||||||
|
# }
|
||||||
#
|
#
|
||||||
# file = "/proc/" pid "/cmdline"; getline command < file; close(file)
|
# file = "/proc/" pid "/cmdline"; getline command < file; close(file)
|
||||||
# gsub(/\0/, " ", command)
|
# gsub(/\0/, " ", command)
|
||||||
|
@ -628,28 +638,36 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# '
|
# '
|
||||||
# ;;
|
# ;;
|
||||||
# *Linux*)
|
# *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/ {
|
# ((/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)
|
# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||||
# }
|
# }
|
||||||
# END {
|
# END {
|
||||||
# pid = pane_pid
|
# pid = pane_pid
|
||||||
# while (child[pid])
|
# while (child[pid]) {
|
||||||
|
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
# pid = child[pid]
|
# pid = child[pid]
|
||||||
|
# }
|
||||||
#
|
#
|
||||||
# print pid":"user[pid]":"command[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/ {
|
# ((/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)
|
# user[$2] = $1; if (!child[$3]) child[$3] = $2; pid=$2; $1 = $2 = $3 = ""; command[pid] = substr($0,4)
|
||||||
# }
|
# }
|
||||||
# END {
|
# END {
|
||||||
# pid = pane_pid
|
# pid = pane_pid
|
||||||
# while (child[pid])
|
# while (child[pid]) {
|
||||||
|
# if (match(command[pid], "^" ssh " |^ssh ")) {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
# pid = child[pid]
|
# pid = child[pid]
|
||||||
|
# }
|
||||||
#
|
#
|
||||||
# print pid":"user[pid]":"command[pid]
|
# print pid":"user[pid]":"command[pid]
|
||||||
# }
|
# }
|
||||||
|
@ -904,7 +922,7 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# if _is_true "$tmux_conf_preserve_stock_bindings"; then
|
# if _is_true "$tmux_conf_preserve_stock_bindings"; then
|
||||||
# probe_socket="$(dirname "$TMUX_SOCKET")/tmux-stock-bindings-$$"
|
# probe_socket="$(dirname "$TMUX_SOCKET")/tmux-stock-bindings-$$"
|
||||||
# TMUX_SOCKET="$probe_socket" tmux -f /dev/null list-keys >> "$cfg"
|
# TMUX_SOCKET="$probe_socket" tmux -f /dev/null list-keys >> "$cfg"
|
||||||
# rm -f "%probe_socket"
|
# rm -f "$probe_socket"
|
||||||
# fi
|
# fi
|
||||||
#
|
#
|
||||||
# # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
|
# # tmux 3.0 doesn't include 02254d1e5c881be95fd2fc37b4c4209640b6b266 and the
|
||||||
|
@ -1607,8 +1625,48 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# fi
|
# fi
|
||||||
# mkdir -p "$TMUX_PLUGIN_MANAGER_PATH"
|
# 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)
|
# 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
|
# if _is_true "$tmux_conf_uninstall_plugins_on_reload" && [ -d "$TMUX_PLUGIN_MANAGER_PATH/tpm" ]; then
|
||||||
# tmux display 'Uninstalling tpm and plugins...'
|
# tmux display 'Uninstalling tpm and plugins...'
|
||||||
# tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH
|
# tmux set-environment -gu TMUX_PLUGIN_MANAGER_PATH
|
||||||
|
@ -1617,11 +1675,6 @@ run 'cut -c3- "$TMUX_CONF" | sh -s _apply_configuration'
|
||||||
# fi
|
# fi
|
||||||
# else
|
# else
|
||||||
# if [ "$(command tmux display -p '#{pid} #{version} #{socket_path}')" = "$("$TMUX_PROGRAM" display -p '#{pid} #{version} #{socket_path}')" ]; then
|
# 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-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGIN_MANAGER_PATH"
|
||||||
# tmux set -g '@tpm_plugins' "$tpm_plugins"
|
# tmux set -g '@tpm_plugins' "$tpm_plugins"
|
||||||
#
|
#
|
||||||
|
|
|
@ -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
|
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).
|
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
|
If you're new to tmux, I recommend you to read [tmux 3: Productive Mouse-Free
|
||||||
Development][bhtmux2] by [@bphogan].
|
Development][bhtmux3] by [@bphogan].
|
||||||
|
|
||||||
Now proceed to [adjust] your `.local` customization file copy.
|
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
|
[@bphogan]: https://twitter.com/bphogan
|
||||||
[adjust]: #configuration
|
[adjust]: #configuration
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue