From 2b8d83f80641a684d18d09f524a7fe04db69b707 Mon Sep 17 00:00:00 2001 From: Hanzala Date: Sun, 14 Jul 2024 10:05:31 -0700 Subject: [PATCH] Enhanced key bindings in .tmux.conf for improved navigation and clipboard management, enabling paste functionality in non-tmux terminals and text editors --- .tmux.conf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.tmux.conf b/.tmux.conf index 0bb0ca7..bc4860b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -129,6 +129,21 @@ if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "\"\$TMUX_PROGRAM\" if -b '[ -c /dev/clipboard ]' 'bind y run -b "\"\$TMUX_PROGRAM\" \${TMUX_SOCKET:+-S \"\$TMUX_SOCKET\"} save-buffer - > /dev/clipboard"' +# -- Mouse and Key Bindings ------------------------------------------------- + +# Enable mouse support +setw -g mouse on + +# Set tmux mode-keys to vi for vi-style key bindings +setw -g mode-keys vi + +# Left-click (MouseDown1Pane) to copy to clipboard +bind -Tcopy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "tmux save-buffer - | xclip -i -selection clipboard && tmux display-message 'Copied to clipboard'" + +# Right-click (MouseDown3Pane) to copy to clipboard +bind -Tcopy-mode-vi MouseDown3Pane send-keys -X copy-pipe-and-cancel "tmux save-buffer - | xclip -i -selection clipboard && tmux display-message 'Copied to clipboard'" + + # -- buffers ------------------------------------------------------------------- bind b list-buffers # list paste buffers