tmux: Improve vim-style yanking

Finally updated tmux scroll-mode yanking to use more vim-style bindings:
Use `v` to select text normally, `V` to select line-wise and `C-v` to
enable rectangle select. `y` yanks to the clipboard (and the internal
tmux register as previously).

Lastly, removed some left-over deprecated code concerning neovim cursor
shape behavior. Was already commented out but now removed completely.

HACK - the yanking to clipboard only works on wayland currently since it
uses `wl-copy` directly instead of the `clip` script. The `clip` script
is not invoked correctly with data being piped since it apparently does
not recognize that it is in a piped call?
This commit is contained in:
Marty Oehme 2022-11-04 15:23:40 +01:00
parent 892544df8e
commit 14f33460df
Signed by: Marty
GPG key ID: 73BA40D5AFAF49C9

View file

@ -1,6 +1,6 @@
# Layout of this conf file: # Layout of this conf file:
# 1. Global Settings # 1. Global Settings
# 2. Keybinds # 2. Plugins
# 3. Keybinds # 3. Keybinds
# 4. Theme # 4. Theme
@ -27,11 +27,8 @@ set -g mouse on
# allow truecolor support # allow truecolor support
set -g default-terminal 'xterm-256color' set -g default-terminal 'xterm-256color'
set -ga terminal-overrides ',xterm-256color:Tc' set -ga terminal-overrides ',xterm-256color:Tc'
# Set Cursor terminal override, so nvim can change cursor style when changing modes
# more info see nvim, :help tui-cursor-shape
# LEGACY: this should not be necessary anymore
# set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
set -g status-keys vi set -g status-keys vi
set-window-option -g mode-keys vi
set -g history-limit 10000 set -g history-limit 10000
# Screen size is based on the smallest client looking at the current windows, not the smallest # Screen size is based on the smallest client looking at the current windows, not the smallest
@ -111,6 +108,12 @@ bind-key '-' split-window -v -c '#{pane_current_path}'
# Open a sessions chooser # Open a sessions chooser
bind C-s split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t" bind C-s split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Make visual selections act a little more like vim
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'wl-copy' \; send -X rectangle-off
bind-key -T copy-mode-vi 'C-v' send -X begin-selection \; send -X rectangle-on
##################### #####################
## 4. THEME ## ## 4. THEME ##
##################### #####################