wip
This commit is contained in:
parent
63d3bfe1ec
commit
6c41c0a6e4
3 changed files with 59 additions and 46 deletions
72
.tmux.conf
72
.tmux.conf
|
@ -15,6 +15,8 @@ set -s escape-time 10 # faster command sequences
|
|||
set -sg repeat-time 600 # increase repeat timeout
|
||||
set -s focus-events on
|
||||
|
||||
set -ga update-environment SSH_TTY # OSC 52 escape sequence receiver
|
||||
|
||||
set -g prefix2 C-a # GNU-Screen compatible prefix
|
||||
bind C-a send-prefix -2
|
||||
|
||||
|
@ -104,27 +106,6 @@ bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}"
|
|||
bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}"
|
||||
|
||||
|
||||
# -- list choice (tmux < 2.4) --------------------------------------------------
|
||||
|
||||
# vi-choice is gone in tmux >= 2.4
|
||||
run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true'
|
||||
run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true'
|
||||
run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true'
|
||||
run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true'
|
||||
run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true'
|
||||
run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true'
|
||||
run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true'
|
||||
|
||||
|
||||
# -- edit mode (tmux < 2.4) ----------------------------------------------------
|
||||
|
||||
# vi-edit is gone in tmux >= 2.4
|
||||
run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true'
|
||||
run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true'
|
||||
run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true'
|
||||
run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true'
|
||||
|
||||
|
||||
# -- copy mode -----------------------------------------------------------------
|
||||
|
||||
bind Enter copy-mode # enter copy mode
|
||||
|
@ -142,15 +123,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 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"'
|
||||
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
|
||||
# copy to Windows clipboard
|
||||
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
|
||||
if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'
|
||||
# copy to OS clipboard
|
||||
bind y run -b 'cut -c3- ~/.tmux.conf | sh -s _copy #{pane_tty}'
|
||||
|
||||
|
||||
# -- buffers -------------------------------------------------------------------
|
||||
|
@ -652,6 +626,33 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# esac
|
||||
# }
|
||||
#
|
||||
# _copy() {
|
||||
# tty="$SSH_TTY"
|
||||
# tty=${tty:-$1}
|
||||
# tty=${tty:-$(tmux display -p '#{pane_tty}')}
|
||||
# buffer=${2:-$(tmux save-buffer - || true)}
|
||||
#
|
||||
# [ -z "$buffer" ] && return
|
||||
#
|
||||
# if [ "$tty" != "$SSH_TTY" ]; then
|
||||
# command -v pbcopy > /dev/null 2>&1 && command='pbcopy'
|
||||
# command -v reattach-to-user-namespace > /dev/null 2>&1 && command='reattach-to-user-namespace pbcopy'
|
||||
# command -v xsel > /dev/null 2>&1 && command='xsel -i -b'
|
||||
# ! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1 && command='xclip -i -selection clipboard > \/dev\/null 2>\&1'
|
||||
# command -v clip.exe > /dev/null 2>&1 && command='clip\.exe'
|
||||
# [ -c /dev/clipboard ] && command='cat > \/dev\/clipboard'
|
||||
#
|
||||
# if [ -n "$command" ]; then
|
||||
# printf %s "$buffer" | $command
|
||||
# return
|
||||
# fi
|
||||
# fi
|
||||
#
|
||||
# # OSC 52
|
||||
# # see https://chromium.googlesource.com/apps/libapps/+/master/nassh/doc/FAQ.md#Is-OSC-52-aka-clipboard-operations_supported
|
||||
# printf '\033Ptmux;\033\033]52;c;%s\a\033\\' "$(printf %s "$buffer" | head -c 74994 | base64 | tr -d '\r\n')" > "$tty"
|
||||
# }
|
||||
#
|
||||
# _apply_overrides() {
|
||||
# tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false}
|
||||
# if _is_enabled "$tmux_conf_theme_24b_colour"; then
|
||||
|
@ -743,6 +744,17 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
|
|||
# fi
|
||||
# fi
|
||||
#
|
||||
# tmux_conf_share_remote_clipboard=${tmux_conf_share_remote_clipboard:-false}
|
||||
# if _is_enabled "$tmux_conf_share_remote_clipboard"; then
|
||||
# if [ -n "$command" ]; then
|
||||
# if _is_enabled "$tmux_conf_copy_to_os_clipboard"; then
|
||||
# perl -p -i -e "s/\bcopy-selection(-and-cancel)?\b '$command'/$& cut -c3- ~\/\.tmux.conf | sh -s _copy #{pane_tty}/g" "$cfg"
|
||||
# else
|
||||
# perl -p -i -e "s/cut -c3- ~\/\.tmux.conf | sh -s _copy #\{pane_tty\}$//g" "$cfg"
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
#
|
||||
# # until tmux >= 3.0, output of tmux list-keys can't be consumed back by tmux source-file without applying some escapings
|
||||
# awk < "$cfg" \
|
||||
# '{i = $2 == "-T" ? 4 : 5; gsub(/^[;]$/, "\\\\&", $i); gsub(/^[$"#~]$/, "'"'"'&'"'"'", $i); gsub(/^['"'"']$/, "\"&\"", $i); print}' > "$cfg.in"
|
||||
|
|
|
@ -4,16 +4,6 @@
|
|||
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
||||
|
||||
|
||||
# -- navigation ----------------------------------------------------------------
|
||||
|
||||
# if you're running tmux within iTerm2
|
||||
# - and tmux is 1.9 or 1.9a
|
||||
# - and iTerm2 is configured to let option key act as +Esc
|
||||
# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys
|
||||
# then uncomment the following line to make Meta + arrow keys mapping work
|
||||
#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D"
|
||||
|
||||
|
||||
# -- windows & pane creation ---------------------------------------------------
|
||||
|
||||
# new window retains current path, possible values are:
|
||||
|
@ -39,7 +29,7 @@ tmux_conf_new_session_prompt=false
|
|||
|
||||
# -- display -------------------------------------------------------------------
|
||||
|
||||
# RGB 24-bit colour support (tmux >= 2.2), possible values are:
|
||||
# RGB 24-bit colour support, possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_theme_24b_colour=false
|
||||
|
@ -48,7 +38,7 @@ tmux_conf_theme_24b_colour=false
|
|||
tmux_conf_theme_window_fg='default'
|
||||
tmux_conf_theme_window_bg='default'
|
||||
|
||||
# highlight focused pane (tmux >= 2.1), possible values are:
|
||||
# highlight focused pane, possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_theme_highlight_focused_pane=false
|
||||
|
@ -266,10 +256,22 @@ tmux_conf_theme_clock_style='24'
|
|||
# in copy mode, copying selection also copies to the OS clipboard
|
||||
# - true
|
||||
# - false (default)
|
||||
#
|
||||
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
||||
# on Linux, this requires xsel or xclip
|
||||
# on operating systems running X.org, this requires installing xsel or xclip
|
||||
# on Windows, clip.exe is used
|
||||
# on Cygwin, /dev/clipboard is used
|
||||
tmux_conf_copy_to_os_clipboard=false
|
||||
|
||||
# when connecting to a remote tmux session running this configuration, copied
|
||||
# text will be sent back to the local clipboard using the OSC 52 escape sequence
|
||||
# - true
|
||||
# - false (default)
|
||||
#
|
||||
# this requires set-clipboard to be set to 'on' or 'external' (default)
|
||||
# this requires having a terminal that emulator that understands the OSC 5
|
||||
# escape sequence
|
||||
tmux_conf_share_remote_clipboard=false
|
||||
|
||||
# -- user customizations -------------------------------------------------------
|
||||
# this is the place to override or undo settings
|
||||
|
|
|
@ -10,8 +10,7 @@ Installation
|
|||
|
||||
Requirements:
|
||||
|
||||
- tmux **`>= 2.1`** (soon `>= 2.4`) running inside Linux, Mac, OpenBSD, Cygwin
|
||||
or WSL
|
||||
- tmux **`>= 2.4`** running inside Linux, Mac, OpenBSD, Cygwin or WSL
|
||||
- awk, perl and sed
|
||||
- outside of tmux, `$TERM` must be set to `xterm-256color`
|
||||
|
||||
|
@ -99,7 +98,7 @@ Features
|
|||
if available
|
||||
- laptop battery status line information
|
||||
- uptime status line information
|
||||
- optional highlight of focused pane (tmux `>= 2.1`)
|
||||
- optional highlight of focused pane
|
||||
- configurable new windows and panes behavior (optionally retain current path)
|
||||
- SSH/Mosh aware split pane (reconnects to remote server)
|
||||
- copy to OS clipboard (needs [`reattach-to-user-namespace`][reattach-to-user-namespace]
|
||||
|
|
Loading…
Reference in a new issue