myshellconfig/tmux/tmux.conf

185 lines
8.2 KiB
Bash

# Some tweaks to the status line
set -g status-right "%H:%M"
#set -g window-status-current-attr "underscore"
# If running inside tmux ($TMUX is set), then change the status line to red
%if #{TMUX}
set -g status-bg red
%endif
# Enable RGB colour if running in xterm(1)
set-option -sa terminal-overrides ",xterm*:Tc"
# Change the default $TERM to tmux-256color
set -g default-terminal "tmux-256color"
# No bells at all
set -g bell-action none
# Keep windows around after they exit
#set -g remain-on-exit on
#########################################################################
## General Options
# set first window to index 1 (not 0) to map more to the keyboard layout
set -g base-index 1
setw -g pane-base-index 1
# Automatically set window title
#set-window-option -g automatic-rename on
# this eats probably much cpu, so turn it off
set-window-option -g automatic-rename off
set-window-option -g window-status-current-style bg=yellow
set-option -g set-titles on
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
set -g history-limit 10000
# pass through xterm keys
set-option -gw xterm-keys on
# Watch for activity in background windows
setw -g monitor-activity on
set -g visual-activity on
#########################################################################
## General Keymap
# Keep your finger on ctrl, or don't, same result
bind-key C-d detach-client
bind-key C-p paste-buffer
# Redraw the client (if interrupted by wall, etc)
bind R refresh-client
# Reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
source-file -q "${HOME}/.tmux.local.conf" \;\
display 'Reloaded personal tmux config.'
unbind R
bind R \
source-file /etc/tmux.conf \;\
display 'Reloaded general tmux config.'
#bind R source-file /etc/tmux.conf
#bind r source-file ~/.tmux.conf
# Use vi keybindings in copy and choice modes
#setw -g mode-keys vi
set-window-option -g mode-keys vi
set -g status-keys vi
##########################################################################
## Window management / navigation
# Horizontal splits with s or C-s
unbind s
unbind C-s
bind-key s split-window
bind-key C-s split-window
# Vertical split with v or C-v
unbind v
unbind C-v
bind-key v split-window -h
bind-key C-v split-window -h
# Alt/Meta M L to switch windows vi-style
bind-key -n M-L next-window
bind-key -n M-H previous-window
# Resize pane vi-style with Control + Cursorkeys
bind-key -n C-Left resize-pane -L
bind-key -n C-Right resize-pane -R
bind-key -n C-Up resize-pane -U
bind-key -n C-Down resize-pane -D
# Use Crtl-vim keys without prefix key to switch panes
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
# easily toggle synchronization (mnemonic: e is for echo)
# sends input to all panes in a given window.
bind e setw synchronize-panes on
bind E setw synchronize-panes off
# No delay for escape key press
set -sg escape-time 0
###########################################################################
# THEME
#set -g status-bg black
#set -g status-fg white
#set -g window-status-current-bg white
#set -g window-status-current-fg black
#set -g window-status-current-attr bold
#set -g status-interval 60
#set -g status-left-length 30
#set -g status-left '#[fg=green](#S) #(whoami)'
#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
#########################################################################
## Mouse
# Start copy mode when scrolling up
#bind -n WheelUpPane copy-mode
set -g mouse on
unbind -n MouseDrag1Pane
unbind -Tcopy-mode MouseDrag1Pane
#set -g mouse-resize-pane on
#set -g mouse-select-pane on
#set -g mouse-select-window on
bind m set -g mouse on \; display "Mouse ON"
bind M set -g mouse off \; display "Mouse OFF"
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
# Enable our custom option to exit copy mode when scrolling past bottom
#set-window-option -g exit-copy-past-bottom on
## Source local and userfiles ##
#source-file -q "${HOME}/.tmux.conf"
source-file -q "${HOME}/.tmux.local.conf"
#source-file -q "${HOME}/.tmux/initial.conf"
#source-file "${HOME}/.tmux/themepack/powerline/block/green.tmuxtheme"
set -g @plugin 'jimeh/tmux-themepack'
# Other examples:
bind S source-file ~/.tmux/sessions/default.session
bind D source-file ~/.tmux/sessions/dev.session
bind L source-file ~/.tmux/sessions/log.session
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
#set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-themepack'
#set -g @themepack 'powerline/block/red'
#source-file "${HOME}/.tmux/plugins/themepack/powerline/block/green.tmuxtheme"
source-file "${HOME}/.tmux/plugins/tmux-themepack/powerline/block/green.tmuxtheme"
# source local tmux.config
source-file -q "${HOME}/.local/share/tmux/tmux.conf"
set -g update-environment "SSH_ASKPASS WINDOWID SSH_CONNECTION XAUTHORITY SSH_TTY SSH_AUTH_SOCK"
#set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'