######################## ## TMUX CONFIGURATION ## ######################## # by Flo Slv # ~/.tmux.conf # Add color for VIM and NEOVIM. # set -g default-terminal "xterm-256color" # FOR VIM set -g default-terminal "screen-256color" # FOR NEOVIM set -ga terminal-overrides ",*256col*:Tc" #################### # KEYBOARD CHANGES # #################### # ctrl+b become ctrl+z. set -g prefix C-z unbind C-b bind C-z send-prefix # ctrl+h or ctrl+l to navigate between windows. bind-key -n C-l next bind-key -n C-h prev # alt + hjkl to navigate between panels. # 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 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L' bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D' bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U' bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R' bind-key -T copy-mode-vi 'M-h' select-pane -L bind-key -T copy-mode-vi 'M-j' select-pane -D bind-key -T copy-mode-vi 'M-k' select-pane -U bind-key -T copy-mode-vi 'M-l' select-pane -R # x to do an vertical split. bind v split-window -h # s to do an horizontal split. bind h split-window -v # Resize panes with C-z + arrows. bind right resize-pane -R 10 bind left resize-pane -L 10 bind up resize-pane -U 10 bind down resize-pane -D 10 # Swap windows bind a swap-window -t -1 bind g swap-window -t +1 # Swap panes bind A swap-pane -t -1 bind G swap-pane -t +1 ################## # USEFUL CHANGES # ################## # Can use mouse inside Tmux. set -g mouse on # Reload configuration. bind r source-file ~/.tmux.conf \; display '.tmux.conf sourced !' # Increase history limit from 2000 to 5000 lines. set-option -g history-limit 5000 # To avoid Neovim warning set-option -sg escape-time 10 # For Neovim/Vim set -g focus-events on ################## # VISUAL CHANGES # ################## set -g base-index 1 # Start windows numbering at 1. set -g pane-base-index 1 # Make pane numbering consistent with windows. setw -g automatic-rename on # Rename window to reflect current program. set -g renumber-windows on # Renumber windows when a window is closed. set -g set-titles on # Set terminal title. set -g display-panes-time 800 # Slightly longer pane indicators display time. set -g display-time 2000 # Slightly longer status messages display time. # Activity # set -g monitor-activity on # set -g visual-activity # Non active panes set-option -g pane-border-style fg='#ffffff' # Active pane set-option -g pane-active-border-style fg='#eb6f92' # Change text color for non active and active panes. set-window-option -g window-style fg=colour247 set-window-option -g window-active-style fg=colour255 # Status right bar to display df -h # set -g status-right '/ #{df_avail}O #{df_percent}' # Tmux powerline set-option -g status on set-option -g status-interval 1 # Redraw status every 1 sec. set-option -g status-justify "centre" set-option -g status-left-length 60 set-option -g status-right-length 90 set-option -g status-left "#(~/.tmux/plugins/tmux-powerline/powerline.sh left)" set-option -g status-right "#(~/.tmux/plugins/tmux-powerline/powerline.sh right)" # Prettifies the window-status segments. set-hook -g session-created 'run-shell "~/.tmux/plugins/tmux-powerline/powerline.sh init"' ########### # PLUGINS # ########### # Tmux Sessionizer. # https://github.com/jrmoulton/tmux-sessionizer bind C-f display-popup -E "tms" bind C-s display-popup -E "tms switch" # List of plugins set -g @plugin 'tmux-plugins/tpm' # TMUX plugin manager. set -g @plugin 'tassaron/tmux-df' # Output df -h in Tmux statusbar. # Initialize TMUX plugin manager # (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'