set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'soyuka/tmux-current-pane-hostname' set -g @plugin 'laktak/extrakto' set -g @plugin 'tmux-plugins/tmux-copycat' set -g @plugin 'schasse/tmux-jump' set -g @continuum-restore 'on' set -g @plugin 'tmux-plugins/tmux-prefix-highlight' set -g @plugin 'tmux-plugins/tmux-online-status' # set -g @plugin 'tmux-plugins/tmux-sidebar' set -g focus-events on set -g default-command /usr/bin/zsh set -g default-shell /usr/bin/zsh set -g default-terminal "tmux-256color" set-option -g prefix C-a set -g status-interval 120 set-option -g history-limit 10000 set-option -g repeat-time 500 #prefix highlight settings set -g @prefix_highlight_show_copy_mode 'on' set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' set -g @prefix_highlight_prefix_prompt 'Wait' set -g @prefix_highlight_copy_prompt 'Copy' set -g @prefix_highlight_output_suffix '' #online status options # set -g @online_icon "ok" # set -g @offline_icon "offline!" set -g @online_icon "#[bg=colour75 fg=colour22]#[bg=colour22] " set -g @offline_icon "#[bg=colour75 fg=colour1]#[bg=colour1] " set -g @jump-key 's' #move/panes panes and windows # bind-key W choose-tree -Zw "swap-window -t '%%'" # bind-key P choose-tree -Zw "swap-pane -t '%%'" # bind-key C-M-w choose-tree -Zw "move-window -t '%%'" # bind-key C-M-p choose-tree -Zw "move-pane -t '%%'" # bind-key C-M-w command-prompt -p "Swap Current Window To? (e.g 3; 4; session_name:5)" "swap-window -t '%%'" # bind-key C-M-p command-prompt -p "Swap Current Pane To? (e.g 2.0; session_name:4.0)" "swap-pane -t '%%'" bind-key M-p command-prompt -p "Move Current Pane To? (e.g 3.1; session_name:6.0)" "move-window -t '%%'" bind-key M-w command-prompt -p "Move Current Window To? (e.g 3.1; session_name:6.0)" "move-pane -t '%%'" #swap panes around # bind-key -r -T prefix C-M-k select-pane -U \; swap-pane -t ! # bind-key -r -T prefix C-M-j select-pane -D \; swap-pane -t ! # bind-key -r -T prefix C-M-h select-pane -L \; swap-pane -t ! # bind-key -r -T prefix C-M-l select-pane -R \; swap-pane -t ! #to support nested tmux sessions for ssh workflows bind -T root F6 \ set prefix None \;\ set key-table off \;\ if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ refresh-client -S \;\ bind -T off F6 \ set -u prefix \;\ set -u key-table \;\ refresh-client -S wg_is_keys_off="#[fg=colour15,bg=colour63,bold]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[fg=colour22] #{?#{pane_ssh_connected},#[fg=colour63 bg=colour24],#[fg=colour63 bg=colour31]}#[default]" # from christoomey's vim-tmux-nivagator is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" #key bindings #do not use alt keybindings. because of the escape passed at the beginning of a alt keycode, #zsh's vim mode's escape becomes slow since tmux will have to wait on keybindings beginning with escape. bind | split-window -h bind - split-window -v bind -r k select-pane -U bind -r j select-pane -D bind -r h select-pane -L bind -r l select-pane -R # bind -n C-w-w select-pane -l bind-key -Ttable1 'C-w' if-shell "$is_vim" 'send-keys C-w' 'select-pane -l' bind-key -Troot 'C-w' if-shell "$is_vim" 'send-keys C-w' 'switch-client -Ttable1' # bind -n S-Right next-window # bind -n S-Left previous-window bind -n C-k next-window bind -n C-j previous-window # bind -n M-Up select-pane -U # bind -n M-Down select-pane -D # bind -n M-Left select-pane -L # bind -n M-Right select-pane -R # bind -r C-k select-pane -U # bind -r C-j select-pane -D # bind -r C-h select-pane -L # bind -r C-l select-pane -R setw -g mode-keys vi bind [ copy-mode bind -T copy-mode-vi 'v' send -X begin-selection bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel #bind -T copy-mode-vi 'V' rectangle-toggle bind ] paste-buffer bind Space choose-buffer # bind C-l send-keys 'C-l' bind -n C-h clear-history #move windows # bind-key -n C-S-Left swap-window -t -1 # bind-key -n C-S-Right swap-window -t +1 # bind-key -n M-S-j swap-window -t -1 # bind-key -n M-S-k swap-window -t +1 bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 #unbindings -- these are reserved for vim use unbind Up unbind Down unbind Left unbind Right # Enable activity alerts. setw -g monitor-activity off set -g visual-activity off set -g pane-active-border-style fg='#669933' set -g pane-border-style fg='#0099ff' # message text set -g message-style bg='#44475a',fg='#8be9fd' #powerline set-option -g status on #set-option -g status-interval 2 set-option -g status-justify "centre" set-option -g status-left-length 120 set-option -g status-right-length 170 # set-option -g status-left "#{prefix_highlight}$wg_is_keys_off#[fg=colour15 bg=colour22]#U@#H#[fg=colour22 bg=colour148]#(/home/devi/tmux-powerline/powerline.sh left)" # set-option -g status-right "#(/home/devi/tmux-powerline/powerline.sh right)#{online_status}" set-option -g status-left "#{prefix_highlight}$wg_is_keys_off#{?#{pane_ssh_connected},#[fg=colour15 bg=colour24],#[fg=colour15 bg=colour31]}#U@#H:#{pane_ssh_port}#{?#{pane_ssh_connected},#[fg=colour24 bg=colour61],#[fg=colour31 bg=colour61]}#(/home/devi/scripts/tmux/vcs_info.sh)" # set-option -g status-left "#{prefix_highlight}$wg_is_keys_off#{?#{pane_ssh_connected},#[fg=colour15 bg=colour31],#[fg=colour15 bg=colour24]}#[fg=colour15 bg=colour31]#U@#H:#{pane_ssh_port}#[fg=colour31 bg=colour61]#(/home/devi/scripts/tmux/vcs_info.sh)" set-option -g status-right "#(/home/devi/scripts/tmux/date.sh)#{online_status}" current_window_format="#{?window_zoomed_flag,#[fg=colour63#, bg=colour16]#[fg=colour63#, bg=colour16#, bold] Z #W #[fg=colour63#, bg=colour16],#[fg=colour255#, bg=colour16] #I #W #[fg=colour255#, bg=colour16]}" set-window-option -g window-status-current-format $current_window_format # set-window-option -g window-status-current-format "#[fg=colour255, bg=colour16]#[fg=colour255, bg=colour16] #I #W #[fg=colour255, bg=colour16]" set -g status-bg colour16 set-window-option -g window-status-format "#[fg=colour32 bg=colour16]#[fg=colour255 bg=colour32]#I#[fg=colour32 bg=colour16]" set-window-option -g window-status-separator "" #run command on idle #set -g lock-after-time 300 #set -g lock-command "cmatrix -C blue" bind-key e copy-mode \; send-keys "?Error" C-m #must be the last line run '~/.tmux/plugins/tpm/tpm'