mirror of https://github.com/fredrikekre/.dotfiles
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
3.5 KiB
83 lines
3.5 KiB
# Force colors for e.g. prompt |
|
set-option -g default-terminal "screen-256color" |
|
set-option -ag terminal-overrides ",xterm-256color:RGB" |
|
|
|
# Enumerate windows from 1 |
|
set -g base-index 1 |
|
# Renumber windows when one is closed to keep a gapless order |
|
set-option -g renumber-windows on |
|
|
|
# Lower escape-time in vim |
|
# see https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed |
|
set -sg escape-time 0 |
|
|
|
# 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' |
|
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' |
|
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ |
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" |
|
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ |
|
"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 |
|
|
|
# vim mode keys in copy-mode |
|
set-window-option -g mode-keys vi |
|
# start selection with v and end with y |
|
## tmux <= 2.3 |
|
if-shell 'tmux -V | grep -Eq "tmux 2\.[0-3]"' " \ |
|
bind-key -t vi-copy 'v' begin-selection; \ |
|
bind-key -t vi-copy 'y' copy-selection; \ |
|
bind -t vi-copy y copy-pipe 'xclip -sel clip -i'; \ |
|
" |
|
|
|
if-shell 'tmux -V | grep -Eq "tmux (2\.[4-9])|(3\.)"' " \ |
|
bind-key -T copy-mode-vi v send-keys -X begin-selection; \ |
|
bind-key -T copy-mode-vi y send-keys -X copy-selection; \ |
|
" |
|
# bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' |
|
|
|
# Faster repeat time |
|
set-option -g repeat-time 300 |
|
|
|
# Exit parent process when detaching from tmux |
|
bind-key d detach-client -P |
|
|
|
# Keep pwd for new splits |
|
bind-key '"' split-window -v -c '#{pane_current_path}' |
|
bind-key % split-window -h -c '#{pane_current_path}' |
|
|
|
# Color scheme from vim-airline's bubblegum theme |
|
airline_grey="colour238" |
|
airline_green="colour150" |
|
airline_blue="colour110" |
|
airline_purple="colour146" |
|
airline_orange="colour179" |
|
airline_red="colour174" |
|
airline_pink="colour182" |
|
|
|
# Status line |
|
set-option -g status-style "bg=$airline_grey,fg=$airline_blue" |
|
set-option -g message-style "bg=$airline_grey,fg=colour255" |
|
set-option -g status-left-length "80" |
|
set-option -g status-left-style "bg=$airline_grey,fg=$airline_blue,bold,noitalics,nounderscore" |
|
set-option -g status-left " #S " |
|
set-option -g status-right-style "bg=$airline_blue,fg=$airline_grey,bold,noitalics,nounderscore" |
|
set-option -g status-right " %Y-%m-%d %H:%M | #h " |
|
set-window-option -g window-status-current-style "bg=$airline_blue,fg=$airline_grey,nobold,noitalics,nounderscore" |
|
set-window-option -g window-status-current-format " #I:#W#{?window_zoomed_flag,*Z,} " |
|
set-window-option -g window-status-style "bg=$airline_grey,fg=$airline_blue,nobold,noitalics,nounderscore" |
|
set-window-option -g window-status-format " #I:#W#{?window_last_flag,-,} " |
|
set-window-option -g window-status-separator "" |
|
set-option -g pane-active-border-style "fg=$airline_blue" |
|
set-option -g pane-border-style "fg=$airline_grey"
|
|
|