feat(tmux): deploy the config on Linux too; prefix i / - splits
- install.sh: deploy_tmux_config runs on both OSes after the bashrc (gated on tmux) - tmux.conf: clipboard via if-shell (pbcopy on macOS, tmux buffer + OSC 52 elsewhere) - bashrc-linux exports XDG_CACHE_HOME like the macOS rc files - prefix i = side-by-side split, prefix - = stacked split (h/j/k/l kept) - verified in an Ubuntu 24.04 container (tmux 3.4): deploy, bindings, split, plugins, libtmux
This commit is contained in:
@@ -139,14 +139,12 @@ bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -R"
|
||||
|
||||
bind Escape copy-mode # bind vi-like 'normal' mode
|
||||
bind -Tcopy-mode-vi 'v' send -X begin-selection # bind vi-like visual mode
|
||||
bind -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" # macOS copy
|
||||
bind p run "pbpaste | tmux load-buffer - ; tmux paste-buffer" # macOS paste
|
||||
# bind vi-like copy/paste through 'normal' mode, (Note) {{{
|
||||
# Linux (X11) variant, xsel rather than xclip: xclip does not close STDOUT
|
||||
# after reading tmux's buffer, so tmux waits for it and hangs.
|
||||
# bind -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "xsel -b -i"
|
||||
# bind p run "xsel -b -o | tmux load-buffer - ; tmux paste-buffer"
|
||||
# }}}
|
||||
# Clipboard: pbcopy/pbpaste on macOS. Elsewhere tmux's own buffer, which tmux
|
||||
# also hands to the terminal through OSC 52 (set-clipboard), so it reaches the
|
||||
# local clipboard over ssh. xsel/xclip dropped: headless servers have no X.
|
||||
if-shell 'command -v pbcopy >/dev/null' \
|
||||
'bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel pbcopy ; bind p run "pbpaste | tmux load-buffer - ; tmux paste-buffer"' \
|
||||
'bind -Tcopy-mode-vi y send -X copy-selection-and-cancel ; bind p paste-buffer'
|
||||
bind-key -Tcopy-mode-vi Escape send -X cancel # cancel v mode
|
||||
bind-key -Tcopy-mode-vi ^v send -X rectangle-toggle # cancel v mode
|
||||
|
||||
@@ -164,6 +162,8 @@ bind-key k "split-window -v -b -c '#{pane_current_path}'"
|
||||
bind-key h "split-window -h -b -c '#{pane_current_path}'"
|
||||
bind-key j "split-window -v -c '#{pane_current_path}'"
|
||||
bind-key l "split-window -h -c '#{pane_current_path}'"
|
||||
bind-key i "split-window -h -c '#{pane_current_path}'" # i: side by side (vertical bar)
|
||||
bind-key - "split-window -v -c '#{pane_current_path}'" # -: stacked (horizontal bar)
|
||||
|
||||
bind q kill-window # Kill window
|
||||
bind Q kill-session # Kill the session (not server)
|
||||
|
||||
Reference in New Issue
Block a user