-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
163 lines (123 loc) · 5.94 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# This is a copy of tmux/tmux.conf from YADR
# skwp/dotfiles @ commit 864794c on 1 Nov 2015
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Bigger history
set -g history-limit 10000
# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice...
set -g status-keys vi
# Use vi keybindings in copy and choice modes
setw -g mode-keys vi
# No escape time for vi mode
set -sg escape-time 0
# set first window to index 1 (not 0) to map more to the keyboard layout...
set-option -g base-index 1
set-window-option -g pane-base-index 1
# color scheme (styled as vim-powerline)
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g pane-border-style fg=colour245
set -g pane-active-border-style fg=colour39
set -g message-style fg=colour16,bg=colour221,bold
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]⮀#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour238,bg=colour234,nobold]⮀'
set -g window-status-format "#[fg=colour235,bg=colour252,bold] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]⮀#[fg=black,bg=colour39,noreverse,bold] #I: #W #[fg=colour39,bg=colour234,nobold]⮀"
# Patch for OS X pbpaste and pbcopy under tmux.
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
# Allow 256-color mode, changing terminal window title and scrolling via PgUp/PgDn
set -g terminal-overrides 'xterm*:colors=256:XT:smcup@:rmcup@'
set-option -sa terminal-overrides ',xterm-256color:RGB'
#set-option -sa terminal-overrides ',xterm-256color:Tc'
# Pass through Ctrl modifiers
setw -g xterm-keys on
set -g window-status-format "#[fg=colour231,bg=colour234,nobold] #I #W "
set -g window-status-current-format "#[fg=colour231,bg=colour164,noreverse,nobold] #I: #W #[fg=colour39,bg=colour234,nobold]"
# Enable mouse
set -g mouse on
# Start non-login shells by default
set -g default-command "${SHELL}"
# Set terminal window title according to current window
set -g set-titles on
# Bindings
# ========
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
# Create splits and vertical splits
bind-key v split-window -h -p 50 -c "#{pane_current_path}"
bind-key ^V split-window -h -p 50 -c "#{pane_current_path}"
bind-key s split-window -p 50 -c "#{pane_current_path}"
bind-key ^S split-window -p 50 -c "#{pane_current_path}"
# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Smart pane switching with awareness of vim splits.
# Source: https://github.com/christoomey/vim-tmux-navigator
# bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
# bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
# bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
# bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
# bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# 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
# Default modifier => Ctrl-a
unbind C-b
set -g prefix C-a
bind a send-prefix
# Alternate modifier => C-Space
bind -n C-Space switch-client -T prefix
bind Space send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Scroll up
bind / copy-mode -u
# Pane/window creation (splitting)
# --------------------------------
unbind %
bind - split-window -v -c "#{pane_current_path}"
bind _ split-window -h -c "#{pane_current_path}"
# New window in default directory
bind C new-window
# New windows/pane in $PWD
bind c new-window -c "#{pane_current_path}"
# Open SSH window
bind S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
# Expand current pane
bind Z resize-pane -Z
# Synchronize panes: broadcast keys to all panes in current window
bind-key s set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
# Session/window/pane switching
# -----------------------------
# Switch to last client
bind l switch-client -l
# Choose a session/window to switch to
bind w choose-tree
# Choose a window (in current session) to switch to
bind '"' choose-window
unbind l
bind C-a last-window
bind C-Space last-window
bind -n M-? last-window
bind -n M-/ last-pane
bind -n M-< previous-window
bind -n M-, next-window
#bind -n C-H run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
#bind -n C-J run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
#bind -n C-K run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
#bind -n C-L run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
# Other
# -----
# toggle mouse (on tmux >= 2.1)
bind u set mouse
# Local config
if-shell "[ -f ~/dotfiles/tmux.conf.user ]" 'source ~/dotfiles/tmux.conf.user'