mirror of
https://github.com/samoshkin/tmux-config.git
synced 2026-01-08 02:38:01 +00:00
Add option to control usage of sharing copy buffer using OSC 52 method
This commit is contained in:
11
install.sh
11
install.sh
@@ -39,14 +39,3 @@ tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
|
|||||||
tmux kill-session -t __noop >/dev/null 2>&1 || true
|
tmux kill-session -t __noop >/dev/null 2>&1 || true
|
||||||
|
|
||||||
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"
|
printf "$(tput setaf 2)OK:$(tput sgr0) Completed\n"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ bind C-r source-file ~/.tmux.conf \; display "Config reloaded"
|
|||||||
# new window and retain cwd
|
# new window and retain cwd
|
||||||
bind c new-window -c "#{pane_current_path}"
|
bind c new-window -c "#{pane_current_path}"
|
||||||
|
|
||||||
|
# Prompt to rename window right after it's created
|
||||||
|
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
|
||||||
|
|
||||||
# Rename session and window
|
# Rename session and window
|
||||||
bind r command-prompt -I "#{window_name}" "rename-window '%%'"
|
bind r command-prompt -I "#{window_name}" "rename-window '%%'"
|
||||||
bind R command-prompt -I "#{session_name}" "rename-session '%%'"
|
bind R command-prompt -I "#{session_name}" "rename-session '%%'"
|
||||||
@@ -118,6 +121,8 @@ bind D if -F '#{session_many_attached}' \
|
|||||||
# Hide status bar on demand
|
# Hide status bar on demand
|
||||||
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
|
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ==================================================
|
# ==================================================
|
||||||
# === Window monitoring for activity and silence ===
|
# === Window monitoring for activity and silence ===
|
||||||
# ==================================================
|
# ==================================================
|
||||||
@@ -139,6 +144,8 @@ set -g visual-activity on
|
|||||||
# ================================================
|
# ================================================
|
||||||
# === Copy mode, scroll and clipboard ===
|
# === Copy mode, scroll and clipboard ===
|
||||||
# ================================================
|
# ================================================
|
||||||
|
set -g @copy_use_osc52_fallback on
|
||||||
|
|
||||||
# Prefer vi style key table
|
# Prefer vi style key table
|
||||||
setw -g mode-keys vi
|
setw -g mode-keys vi
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ is_app_installed() {
|
|||||||
buf=$(cat "$@")
|
buf=$(cat "$@")
|
||||||
|
|
||||||
copy_backend_remote_tunnel_port=$(tmux show-option -gvq "@copy_backend_remote_tunnel_port")
|
copy_backend_remote_tunnel_port=$(tmux show-option -gvq "@copy_backend_remote_tunnel_port")
|
||||||
|
copy_use_osc52_fallback=$(tmux show-option -gvq "@copy_use_osc52_fallback")
|
||||||
|
|
||||||
# Resolve copy backend: pbcopy (OSX), reattach-to-user-namespace (OSX), xclip/xsel (Linux)
|
# Resolve copy backend: pbcopy (OSX), reattach-to-user-namespace (OSX), xclip/xsel (Linux)
|
||||||
copy_backend=""
|
copy_backend=""
|
||||||
@@ -31,7 +32,13 @@ if [ -n "$copy_backend" ]; then
|
|||||||
exit;
|
exit;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If no copy backends were eligible, fallback to OSC 52 escape sequences
|
|
||||||
|
# If no copy backends were eligible, decide to fallback to OSC 52 escape sequences
|
||||||
|
# Note, most terminals do not handle OSC
|
||||||
|
if [ "$copy_use_osc52_fallback" == "off" ]; then
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
# Copy via OSC 52 ANSI escape sequence to controlling terminal
|
# Copy via OSC 52 ANSI escape sequence to controlling terminal
|
||||||
buflen=$( printf %s "$buf" | wc -c )
|
buflen=$( printf %s "$buf" | wc -c )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user