1
0
mirror of https://github.com/samoshkin/tmux-config.git synced 2026-01-05 09:18:01 +00:00

Add option to control usage of sharing copy buffer using OSC 52 method

This commit is contained in:
Alexey Samoshkin
2017-11-24 23:57:34 +02:00
parent 86d1c9d3b0
commit 6377634a56
3 changed files with 15 additions and 12 deletions

View File

@@ -68,6 +68,9 @@ bind C-r source-file ~/.tmux.conf \; display "Config reloaded"
# new window and retain cwd
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
bind r command-prompt -I "#{window_name}" "rename-window '%%'"
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
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
# ==================================================
# === Window monitoring for activity and silence ===
# ==================================================
@@ -139,6 +144,8 @@ set -g visual-activity on
# ================================================
# === Copy mode, scroll and clipboard ===
# ================================================
set -g @copy_use_osc52_fallback on
# Prefer vi style key table
setw -g mode-keys vi

View File

@@ -10,6 +10,7 @@ is_app_installed() {
buf=$(cat "$@")
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)
copy_backend=""
@@ -31,7 +32,13 @@ if [ -n "$copy_backend" ]; then
exit;
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
buflen=$( printf %s "$buf" | wc -c )