From 7ebe1d33475e8e2459574f2abfefd7fedb01dbcf Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:49:53 +0100 Subject: [PATCH] Tmux copy-paste (#122) --- home-manager/modules/tmux.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/home-manager/modules/tmux.nix b/home-manager/modules/tmux.nix index c585cb9..a2d8849 100644 --- a/home-manager/modules/tmux.nix +++ b/home-manager/modules/tmux.nix @@ -14,6 +14,26 @@ extraConfig = '' set-option -sa terminal-features ',xterm-256color:RGB' set -g default-command "exec ${pkgs.zsh}/bin/zsh" + + # Vi mode + set-window-option -g mode-keys vi + + # Use v to begin selection in copy mode + bind-key -T copy-mode-vi v send-keys -X begin-selection + + # Use Shift+V to select line + bind-key -T copy-mode-vi V send-keys -X select-line + + # Use y to yank to clipboard + ${ + if pkgs.stdenv.isDarwin + then '' + bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" + '' + else '' + bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "${pkgs.wl-clipboard}/bin/wl-copy" + '' + } ''; }; }