aboutsummaryrefslogblamecommitdiffstats
path: root/.tmux.conf
blob: 19db8493fc5f8de547717e69ceed804cf41bec1e (plain) (tree)
1
2
3
4
5
6
7
8
9

                                            
                                                


                                                  
                                  
                                       
                                  
                                                   
                                            


                                    
 
                                            
                                                                                                

                                                                               
 







                                             



                            

                                        
                      

                      

                             


                                   
                                     
                             




                                 
                        


                                            
                                                                    






                                             

                                                                  
 

                    














                                                                                                             



                                        
                                       
 











                                                   
                                                                                                                                                                                                                         

                                                                                                            








                                                                                                        


                                                                                 







                                



                            







                                                          
                         
                                                                                            








                                                             



                            
                   
                                                 
                                     

                              
                                                                            
                                                                 



                                              
                       



                                     
                                                                                                                                                            

                                                                                                                                                                                    
















                                                                                                                                                                                                                  
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-online-status'
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 @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-continuum'

set -g @continuum-restore 'on'
set -g @continuum-save-interval '15'

# set -g @plugin 'tmux-plugins/tmux-sidebar'
# set -g @resurrect-processes `ranger ssh w3mlastsession k9s top cointop newsboat irssi neomutt`
set -g @fzf-url-history-limit '2000'
set -g @fzf-url-fzf-options '-w 50% -h 50% --multi -0 --no-preview --no-border'

#unbindings -- these are reserved for vim use
unbind Up
unbind Down
unbind Left
unbind Right
unbind-key p
unbind-key n

# set -g automatic-rename on
# set -g renumber-windows on
# set -g- set-titles on

set-window-option -g automatic-rename on
set-option -g set-titles on
set -g focus-events on
# dont wait for escape
set -sg escape-time 0
# bind-key -g C-a last-window
# bind-key a send-prefix

set -g default-command /usr/bin/zsh
set -g default-shell /usr/bin/zsh
set -g default-terminal "st-256color"
set -s set-clipboard external

set-option -g prefix C-a
set -g status-interval 120
set-option -g history-limit 10000
set-option -g repeat-time 500
set -g display-time 1000

#prefix highlight settings
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=colour16,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=colour25 fg=colour22]#[bg=colour22] "
set -g @offline_icon "#[bg=colour25 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 !

# hide a pane and bring it back again
bind-key ! break-pane -d -n _hidden_pane
bind-key @ join-pane -s $.0

bind-key p popup -w 80% -h 80% -E xonsh

#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=colour24] #{?#{pane_ssh_connected},#[fg=colour63 bg=colour70],#[fg=colour63 bg=colour70]}#[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
bind P pipe-pane -o "cat >>~/.tmuxrecording/#W.log" \; display "Toggled logging to ~/#W.log"

#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

# Enable activity alerts.
setw -g monitor-activity off
set -g visual-activity off

# pane border style
set -g pane-active-border-style fg='#669933',bold
set -g pane-border-style fg='#0099ff'
set -g pane-border-status top
set -g pane-border-lines heavy
# set -g pane-border-format "#{pane_index}:#{s/sudo//:pane_current_command}"
set -g pane-border-format "#{pane_index}:#{pane_current_command}"

# message text
set -g message-style bg='#44475a',fg='#8be9fd'

set-option -g status on
set-option -g status-justify "centre"
set-option -g status-left-length 120
set-option -g status-right-length 170

continuumStatus="#[fg=colour16 bg=colour70 bold]#(xkb-switch -p)#[nobold]#{?#{pane_ssh_connected},#[fg=colour70 bg=colour31],#[fg=colour70 bg=colour24]}"
sshStatus="#{?#{pane_ssh_connected},#[fg=colour15 bold],#[fg=colour15 nobold]}#U@#H#{?#{pane_ssh_connected},:#{pane_ssh_port}#[fg=colour31 bg=colour26],#[fg=colour24 bg=colour26]}"
set-option -g status-left "#{prefix_highlight}$wg_is_keys_off$continuumStatus$sshStatus#[nobold]#(/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'