From 164da6f3ad8441afe47f27311d1521334ae95920 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Jan 2025 12:43:26 +0000 Subject: [PATCH] tmux settings file --- tmux/.tmux.conf | 116 ++++++++++++++++++++++++++++++ tmux/.tmux/plugins/extrakto | 1 + tmux/.tmux/plugins/tmux-battery | 1 + tmux/.tmux/plugins/tmux-cpu | 1 + tmux/.tmux/plugins/tmux-power | 1 + tmux/.tmux/plugins/tmux-resurrect | 1 + tmux/.tmux/plugins/tmux-sensible | 1 + tmux/.tmux/plugins/tmux-themepack | 1 + tmux/.tmux/plugins/tmux-yank | 1 + tmux/.tmux/plugins/tpm | 1 + 10 files changed, 125 insertions(+) create mode 100644 tmux/.tmux.conf create mode 160000 tmux/.tmux/plugins/extrakto create mode 160000 tmux/.tmux/plugins/tmux-battery create mode 160000 tmux/.tmux/plugins/tmux-cpu create mode 160000 tmux/.tmux/plugins/tmux-power create mode 160000 tmux/.tmux/plugins/tmux-resurrect create mode 160000 tmux/.tmux/plugins/tmux-sensible create mode 160000 tmux/.tmux/plugins/tmux-themepack create mode 160000 tmux/.tmux/plugins/tmux-yank create mode 160000 tmux/.tmux/plugins/tpm diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..25c8a3a --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,116 @@ +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'wfxr/tmux-power' +set -g @plugin 'tmux-plugins/tmux-battery' +set -g @plugin 'jimeh/tmux-themepack' +set -g @themepack 'powerline/double/red' +#set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'laktak/extrakto' +set -g @plugin 'tmux-plugins/tmux-cpu' + +# Restore tmux environment after system restart. +set -g @plugin 'tmux-plugins/tmux-resurrect' + +# TMUX CPU +set -g status-left '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' + +# Resizing panes by mouse +set -g mouse on +# make scrolling with wheels work +bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" +bind -n WheelDownPane select-pane -t= \; send-keys -M + + +#set -g @yank_with_mouse on +# or 'on' +#set -g mode-mouse on +#set -g mouse-resize-pane on + +# key-binding for nested tmux ssh +#set -g prefix C-B + +# send the prefix to client inside window +#bind-key -n C-n send-prefix +#:q0 +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +# Copy mode by vi +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l + + +# Resize by c-HJKL +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r L resize-pane -R 5 + +set-option -g history-limit 50000 + +set-window-option -g mode-keys vi + +# Set new panes to open in current directory +bind c new-window -c "#{pane_current_path}" +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" + +# Copy to ubuntu clipboard +# https://coderwall.com/p/4b0d0a/how-to-copy-and-paste-with-tmux-on-ubuntu +# bind -t vi-copy y copy-pipe "xclip -sel clip -i" +# copy & paste between tmux and x clipboard +#bind C-p run-shell "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" +#bind C-y run-shell "tmux show-buffer | xclip -sel clip -i" +#bind-key -temacs-copy M-w copy-pipe "xclip -selection clipboard -in" +#bind-key -T copy-mode M-w send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -in" +#bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" + + +# Second try to use clipboard +#set -s set-clipboard on +#set -s set-clipboard external +set -as terminal-features ',rxvt-unicode-256color:clipboard' +#set -s copy-command 'xsel -i' +#bind -Tcopy-mode-vi C-j send -X copy-pipe-and-cancel 'xsel -i' +#bind -Tcopy-mode-vi Enter send -X copy-pipe-and-cancel 'xsel -i' +#bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel 'xsel -i' +#set -s set-clipboard off +#bind-key -T root MouseDown2Pane run-shell "xclip -selection primary -o >~/.tmux-buffer-tmp" \; load-buffer -b tmp-copy-buffer ~/.tmux-buffer-tmp \; paste-buffer -b tmp-copy-buffer -d \; run-shell -b "rm ~/.tmux-buffer-tmp" +set-option -g mouse on +#set-option -s set-clipboard off + +# Copy into xserver clipboard by mouse clip +#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" +#bind-key -T copy-mode-vi M-w send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -in" +#bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer" + +# To copy: +#bind-key -n -t emacs-copy 'M-w' copy-pipe "xclip -i -sel p -f | xclip -i -sel c " + +# To paste: +#bind-key -n 'C-y' run "xclip -o | tmux load-buffer - ; tmux paste-buffer" +bind-key -n -T copy-mode-vi Enter send-keys -X copy-pipe 'xclip -i -sel p -f | xclip -i -sel c' +bind-key -n -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe 'xclip -i -sel p -f | xclip -i -sel c' + + + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' + + + diff --git a/tmux/.tmux/plugins/extrakto b/tmux/.tmux/plugins/extrakto new file mode 160000 index 0000000..4ce105d --- /dev/null +++ b/tmux/.tmux/plugins/extrakto @@ -0,0 +1 @@ +Subproject commit 4ce105d42cdf5eb0ebf7287c2ad1a7c354b31498 diff --git a/tmux/.tmux/plugins/tmux-battery b/tmux/.tmux/plugins/tmux-battery new file mode 160000 index 0000000..5c52d4f --- /dev/null +++ b/tmux/.tmux/plugins/tmux-battery @@ -0,0 +1 @@ +Subproject commit 5c52d4f7f80384de0781c2277a8989ba98fae507 diff --git a/tmux/.tmux/plugins/tmux-cpu b/tmux/.tmux/plugins/tmux-cpu new file mode 160000 index 0000000..9eb3dba --- /dev/null +++ b/tmux/.tmux/plugins/tmux-cpu @@ -0,0 +1 @@ +Subproject commit 9eb3dba66672c5b43065e144cc3a1031f77ad67e diff --git a/tmux/.tmux/plugins/tmux-power b/tmux/.tmux/plugins/tmux-power new file mode 160000 index 0000000..2c5dd0f --- /dev/null +++ b/tmux/.tmux/plugins/tmux-power @@ -0,0 +1 @@ +Subproject commit 2c5dd0f998993c8a999c66e9ac1d0ab8f79bd972 diff --git a/tmux/.tmux/plugins/tmux-resurrect b/tmux/.tmux/plugins/tmux-resurrect new file mode 160000 index 0000000..cff343c --- /dev/null +++ b/tmux/.tmux/plugins/tmux-resurrect @@ -0,0 +1 @@ +Subproject commit cff343cf9e81983d3da0c8562b01616f12e8d548 diff --git a/tmux/.tmux/plugins/tmux-sensible b/tmux/.tmux/plugins/tmux-sensible new file mode 160000 index 0000000..25cb91f --- /dev/null +++ b/tmux/.tmux/plugins/tmux-sensible @@ -0,0 +1 @@ +Subproject commit 25cb91f42d020f675bb0a2ce3fbd3a5d96119efa diff --git a/tmux/.tmux/plugins/tmux-themepack b/tmux/.tmux/plugins/tmux-themepack new file mode 160000 index 0000000..7c59902 --- /dev/null +++ b/tmux/.tmux/plugins/tmux-themepack @@ -0,0 +1 @@ +Subproject commit 7c59902f64dcd7ea356e891274b21144d1ea5948 diff --git a/tmux/.tmux/plugins/tmux-yank b/tmux/.tmux/plugins/tmux-yank new file mode 160000 index 0000000..1b1a436 --- /dev/null +++ b/tmux/.tmux/plugins/tmux-yank @@ -0,0 +1 @@ +Subproject commit 1b1a436e19f095ae8f825243dbe29800a8acd25c diff --git a/tmux/.tmux/plugins/tpm b/tmux/.tmux/plugins/tpm new file mode 160000 index 0000000..b699a7e --- /dev/null +++ b/tmux/.tmux/plugins/tpm @@ -0,0 +1 @@ +Subproject commit b699a7e01c253ffb7818b02d62bce24190ec1019