setw -g xterm-keys on set-option -g prefix C-a bind-key C-a last-window set-window-option -g mode-keys vi set -s escape-time 50 # colors set -g default-terminal "screen-256color" # testing https://github.com/hamvocke/dotfiles/tree/master/tmux # reload config file bind r source-file ~/.tmux.conf # don't rename windows automatically set-option -g allow-rename off # modes setw -g clock-mode-colour colour5 set -g mode-style fg=colour1,bg=colour18,bold # panes set -g pane-border-style fg=colour242,bg=colour236 set -g pane-active-border-style fg=colour112,bg=colour236 # statusbar set -g status-position bottom set -g status-justify left set -g status-style fg=colour137,bg=colour241,dim set -g status-left '' set -g status-right '#[fg=colour232,bg=colour241,bold]B:#(~/bin/get_bat.sh) %a %m/%d #[fg=colour232,bg=colour240,bold] %l:%M %P ' set -g status-right-length 50 set -g status-left-length 20 setw -g window-status-current-style fg=colour10,bg=colour249,bold setw -g window-status-current-format ' #I#[fg=colour0]:#[fg=colour0]#W#[fg=colour0]#F ' setw -g window-status-style fg=colour9,bg=colour238,bold setw -g window-status-format ' #I#[fg=colour255]:#[fg=colour255]#W#[fg=colour255]#F ' ####################################### # MOUSE SCROLL WHEEL # Make mouse useful in copy mode setw -g mouse on # https://github.com/tmux/tmux/issues/1320#issuecomment-381952082 # Emulate scrolling by sending up and down keys if these commands are running in the pane tmux_commands_with_legacy_scroll="nano less more man git" bind-key -T root WheelUpPane \ if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \ 'send -Mt=' \ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ "send -t= Up Up Up" "copy-mode -et="' bind-key -T root WheelDownPane \ if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \ 'send -Mt=' \ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \ "send -t= Down Down Down" "send -Mt="' # copy selection to X windows clipboard #set -g set-clipboard off bind-key -T copy-mode-vi v send -X begin-selection bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -sel clip > /dev/null" ########################################## # TERMINAL EMULATOR TITLES set -g set-titles on #set -g set-titles-string "#(tmux ls | awk -F: '{print $1}' | xargs | sed 's/\ / | /g')" # 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" #bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" 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 # start new splits/windows with "pane_current_path" #bind c new-window -c "#{pane_current_path}" bind '%' split-window -h -c "#{pane_current_path}" bind '"' split-window -v -c "#{pane_current_path}" set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @resurrect-strategy-vim 'session' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-restore 'on' run '~/.tmux/plugins/tpm/tpm'