.tmux.conf 2.72 KB
Newer Older
doshitan's avatar
doshitan committed
1
2
3
4
5
6
7
8
9
# tmux configuration
#
# Various bits pulled from all over:
#   * https://github.com/tangledhelix/dotfiles/blob/master/tmux.conf
#
# TODO
#   * Enable/style activity alerts

setw -g mode-keys vi
doshitan's avatar
doshitan committed
10
11
12
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X rectangle-toggle
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
doshitan's avatar
doshitan committed
13
14
15
16
17

set -g default-terminal "screen-256color"

set -g history-limit 10000

doshitan's avatar
doshitan committed
18
19
20
21
22
# 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

23
24
# Clear screen
bind C send-keys -R
doshitan's avatar
doshitan committed
25

doshitan's avatar
doshitan committed
26
27
28
# https://bitbucket.org/lyro/evil/issue/69/delay-between-esc-or-c-and-modeswitch
set -s escape-time 0

doshitan's avatar
doshitan committed
29
30
31
# Mouse #####################################################################
# http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/

doshitan's avatar
doshitan committed
32
set -g mouse on
doshitan's avatar
doshitan committed
33
34
35

# Toggle mouse on
bind m \
doshitan's avatar
doshitan committed
36
    set -g mouse on \;\
doshitan's avatar
doshitan committed
37
38
39
40
    display 'Mouse: ON'

# Toggle mouse off
bind M \
doshitan's avatar
doshitan committed
41
    set -g mouse off \;\
doshitan's avatar
doshitan committed
42
43
44
45
46
47
48
49
    display 'Mouse: OFF'


# Theme #####################################################################

# Center the window list
set -g status-justify centre

50
set -g status-style bg=default
doshitan's avatar
doshitan committed
51

52
setw -g window-status-format "#[bg=white, fg=colour8] #I #[bg=colour8, fg=white] #W "
53
setw -g window-status-style dim
doshitan's avatar
doshitan committed
54

55
setw -g window-status-current-format "#[bg=colour7, fg=black] #I #[bg=colour15, fg=black] #W "
56
setw -g window-status-current-style bright
doshitan's avatar
doshitan committed
57

58
# remove administrative debris (hostname, time) in status bar
doshitan's avatar
doshitan committed
59
set -g status-left "#[bg=white, fg=colour8, bold] ❐ #S "
60
set -g status-left-length 20
doshitan's avatar
doshitan committed
61
62
63
64
65
66
67
68
set -g status-right ''


# Bindings ##################################################################

unbind r
bind r source-file ~/.tmux.conf \; display-message "Configuration reloaded"

69
70
# Smart pane switching with awareness of vim splits
# https://github.com/christoomey/vim-tmux-navigator
71
72
73
74
75
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
doshitan's avatar
doshitan committed
76
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
77

78
79
80
# Restore clear screen behavior to <prefix> C-l
bind C-l send-keys 'C-l'

81
82
83
84
85
# Session management
bind-key S new-session
# Copied from http://unix.stackexchange.com/a/58616
bind-key X confirm-before -p "Kill #S (y/n)?" "run-shell 'tmux switch-client -n \\\; kill-session -t \"\$(tmux display-message -p \"#S\")\"'"

doshitan's avatar
doshitan committed
86
87
88
89

# Local config ##############################################################

if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'