tmux settings file

This commit is contained in:
root 2025-01-15 12:43:26 +00:00
parent 901b621117
commit 164da6f3ad
10 changed files with 125 additions and 0 deletions

116
tmux/.tmux.conf Normal file
View File

@ -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'

@ -0,0 +1 @@
Subproject commit 4ce105d42cdf5eb0ebf7287c2ad1a7c354b31498

@ -0,0 +1 @@
Subproject commit 5c52d4f7f80384de0781c2277a8989ba98fae507

@ -0,0 +1 @@
Subproject commit 9eb3dba66672c5b43065e144cc3a1031f77ad67e

@ -0,0 +1 @@
Subproject commit 2c5dd0f998993c8a999c66e9ac1d0ab8f79bd972

@ -0,0 +1 @@
Subproject commit cff343cf9e81983d3da0c8562b01616f12e8d548

@ -0,0 +1 @@
Subproject commit 25cb91f42d020f675bb0a2ce3fbd3a5d96119efa

@ -0,0 +1 @@
Subproject commit 7c59902f64dcd7ea356e891274b21144d1ea5948

@ -0,0 +1 @@
Subproject commit 1b1a436e19f095ae8f825243dbe29800a8acd25c

@ -0,0 +1 @@
Subproject commit b699a7e01c253ffb7818b02d62bce24190ec1019