From 14f33460dfcb1aea6991874fffe9f5bafaeee33f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 4 Nov 2022 15:23:40 +0100 Subject: [PATCH] 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? --- tmux/.config/tmux/tmux.conf | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index fcd03d7..5e477b4 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -1,6 +1,6 @@ # Layout of this conf file: # 1. Global Settings -# 2. Keybinds +# 2. Plugins # 3. Keybinds # 4. Theme @@ -27,11 +27,8 @@ set -g mouse on # allow truecolor support set -g default-terminal 'xterm-256color' 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-window-option -g mode-keys vi set -g history-limit 10000 # 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 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 ## #####################