-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
145 lines (112 loc) · 4.43 KB
/
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
142
143
144
145
#######
# Fixes
#######
# Tell Tmux to use a wrapper program to start a shell, fixes various user
# permission issues when using pbpaste/pbcopy and launchctl etc.
# Install the required program with `brew install reattach-to-user-namespace`
# See: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
#set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# Enable dim-med colours: http://unix.stackexchange.com/a/234591
set -sa terminal-overrides ",*:dim=\\E[2m"
#######################
# screen-like behaviour
#######################
# Ctrl-a for prefix like screen
set -g prefix C-a
unbind C-b
# Minimize key-sending delay
set -sg escape-time 0
# Repeat commands timeout: leave reasonable time, and for key bindings where
# repeat time causes issues remove repeat (-r) feature.
set -g repeat-time 1000
# Detach with PREFIX Ctrl-d, not just PREFIX d
bind C-d detach-client
# Create window with PREFIX Ctrl-c, not just PREFIX c
bind C-c new-window
# Rename window with PREFIX A, not just PREFIX ,
bind A command-prompt -I '#W' "rename-window '%%'"
###############
# Tmux niceties
###############
# Number windows from 1, not 0
set-option -g base-index 1
# Split panes
bind | split-window -h
bind - split-window -v
# Rebind arrow keys for pane selection, without repeat for better behaviour
# when switching windows/panes then hitting UP for last terminal command.
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
# Navigate between windows (left, right)
bind -r C-p select-window -t :-
bind -r C-n select-window -t :+
# Enable mouse support
setw -g mouse on
# Toggle mouse support
bind m setw -g mouse on
bind M setw -g mouse off
# 256 colors
# Be sure to avoid clobbering $TERM in .bashrc with something like:
# [[ -z $TMUX ]] && export TERM=xterm-256color
set -g default-terminal "screen-256color"
# Color scheme
set -g status-fg white
set -g status-bg black
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
setw -g window-status-current-fg red
setw -g window-status-current-bg default
setw -g window-status-current-attr bright
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg black
set -g pane-active-border-bg green
# Status bar
set -g status-justify left
set -g message-fg white
set -g message-bg black
set -g message-attr bright
set -g status-left "#[fg=green][#S]"
set -g status-right "#[fg=cyan]#h %Y-%m-%d %R "
setw -g monitor-activity off
set -g visual-activity off
# Buffer navigation, vi-style
setw -g mode-keys vi
# Don't clear screen upon program exit (e.g. after less or ack)
set-window-option -g alternate-screen off
# 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
##########################################################
# Tmux Plugin Manager: https://github.com/tmux-plugins/tpm
##########################################################
# Prep work: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# List of plugins.
# Install with `prefix` + I ([I]nstall) to fetch and install plugins.
# Update with `prefix` + u ([u]pdate) to update installed plugins.
# Remove with `prefix` + alt + u ([u]ninstall) to remove plugins no longer here.
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'