From b4eba71b1649fc94319917b185a0fec2e0e5757a Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 14 Jun 2023 12:24:08 +0200 Subject: [PATCH] tmux: C-v should start the selection if inactive --- .config/tmux/tmux.conf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 39b116e..8380e31 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -84,9 +84,18 @@ bind -r \} swap-pane -D # Enter copy-mode with Escape bind Escape copy-mode -# Start selection (e.g. visual mode) with `v` + +# Start selection (i.e. visual mode) with `v`, and rectangle selection (i.e. +# visual block mode) with `C-v` +# TODO: mimic vims behaviour for visual mode cycling and toggling unbind -T copy-mode-vi v bind -T copy-mode-vi v send -X begin-selection +unbind -T copy-mode-vi C-v +bind -T copy-mode-vi C-v { + if -F "#{selection_active}" {} { send -X begin-selection } + send -X rectangle-toggle +} + # Yank into system clipboard # TODO: This breaks on repeatable movements (e.g. `y2e`) bind -T copy-mode-vi y \