-
Notifications
You must be signed in to change notification settings - Fork 3
/
dot_tmux.conf
141 lines (118 loc) · 4.75 KB
/
dot_tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Plugins # {{{
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'mshkrebtan/base16-tmux'
# set -g @plugin 'thalesmello/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# }}}
# Plugin configs # {{{
## Yank
set -g @shell_mode 'vi'
## Prefix highlight show when in yank mode.
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
# }}}
# {{{ New session commands
run '~/.tmux/plugins/tpm/tpm'
# }}}
# {{{ Misc options
# Set default shell to open in tmux
set-option -g default-command $SHELL
set-option -g default-shell $SHELL
# 0 is too far from ` ;)
set-option -g base-index 1
set-window-option -g pane-base-index 1
# tmux can cause a delay on mode switching in vim this eliminates it
set -s escape-time 0
# }}}
# {{{ Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
set-option -g set-titles-string '[#S:#I #h] #W'
# }}}
# {{{ Key bindings
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi Escape send -X cancel
set-option -g prefix C-a
bind-key C-a last-window
bind-key a send-prefix
# toggle mouse mode to allow mouse copy/paste
## set mouse on with prefix m
bind m \
set -g mode-mouse on \;\
if-shell 'test "`tmux -V`" != "tmux 1.4"' 'set-option -g mouse-resize-pane on' \;\
set -g mouse-select-pane on \;\
if-shell 'test "`tmux -V`" != "tmux 1.4"' 'set-option -g mouse-select-window on' \;\
display 'Mouse: ON'
## set mouse off with prefix M
bind M \
set -g mode-mouse off \;\
if-shell 'test "`tmux -V`" != "tmux 1.4"' 'set-option -g mouse-resize-pane off' \;\
set -g mouse-select-pane off \;\
if-shell 'test "`tmux -V`" != "tmux 1.4"' 'set-option -g mouse-select-window off' \;\
display 'Mouse: OFF'
bind-key Space choose-session
# Vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Navigation between panes using ctrl + hjkl
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'
# # Use Alt-vim keys without prefix key to switch panes
# bind -n M-h select-pane -L
# bind -n M-j select-pane -D
# bind -n M-k select-pane -U
# bind -n M-l select-pane -R
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Disable set-clipboard
set -s set-clipboard off
# Copy to clipboard without tmux-yank that seems to have broken with version 3.
if-shell -b '[ -z "$WAYLAND_DISPLAY" ] && ! uname | grep -q Darwin' \
"bind -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel \"xclip -selection clipboard\""
if-shell 'uname | grep -q Darwin' \
"bind -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel \"pbcopy\""
if-shell '[ -n "$WAYLAND_DISPLAY" ]' \
"bind -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel \"wl-copy\""
# Reload tmux config
bind r source-file ~/.tmux.conf \; display-message 'Reloaded ~/.tmux.conf!'
# }}}
# {{{ Set window notifications
setw -g monitor-activity on
set -g visual-activity off
set-option -g focus-events on
# }}}
# {{{ Terminal colour support
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",screen-256color:Tc"
set -ga terminal-overrides ",st-256color:Tc"
set -ga terminal-overrides ",xterm-*:Tc"
# }}}
# {{{ Misc options
set -g history-limit 100000
# }}}
# {{{ Set colours
set -g status 'on'
set -g status-bg colour8
set -g status-fg white
set -g status-justify 'left'
set -g status-left-length '100'
set -g status-right-length '100'
setw -g window-status-separator ''
set -g status-left '#{prefix_highlight}#[fg=colour0,bg=colour2,bold] #S #[fg=colour2,bg=colour08,nobold,nounderscore,noitalics]'
set -g status-right '#[fg=colour7,bg=colour8,nobold,nounderscore,noitalics]#[fg=colour0,bg=colour7] %Y-%m-%d %H:%M #[fg=colour2,bg=colour7,nobold,nounderscore,noitalics]#[fg=colour0,bg=colour2] #h '
setw -g window-status-format '#[fg=colour7,bg=colour8] #I#F #[fg=colour7,bg=colour8] #W'
setw -g window-status-current-format '#[fg=colour8,bg=colour7,nobold,nounderscore,noitalics]#[fg=colour0,bg=colour7] #I#F #[fg=colour0,bg=colour7] #W #[fg=colour7,bg=colour8,nobold,nounderscore,noitalics]'
# }}}