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