-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
180 lines (147 loc) · 6.33 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# SCREENSHOT EXAMPLE: http://grab.by/bzg3
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
############################################################################
############################################################################
# Reset Prefix
############################################################################
set -g prefix C-o
unbind C-b
bind-key C-o send-prefix # for nested tmux sessions
############################################################################
# Global options
############################################################################
# large history
set-option -g history-limit 10000
# colors
setw -g mode-bg black
set-option -g default-terminal "screen-256color" #"xterm-256color" # "screen-256color"
set-option -g pane-active-border-fg green
# utf8 support
set-window-option -g utf8 on
# basic settings
set-window-option -g xterm-keys on # for vim
set-window-option -g mode-keys vi # vi key
set-window-option -g monitor-activity on
set-window-option -g window-status-current-fg white
setw -g window-status-current-attr reverse
# Automatically set window title
setw -g automatic-rename
# use mouse # More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
setw -g mode-mouse on
#setw -g mouse-resize-pane on
#set -g mouse-select-window on
set -g mouse-select-pane on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# vi movement keys
# set-option -g status-keys vi
############################################################################
# Status Bar
############################################################################
set-option -g status-utf8 on
set-option -g status-justify right
set-option -g status-bg black # colour213 # pink
set-option -g status-fg cyan
set-option -g status-interval 5
set-option -g status-left-length 30
set-option -g status-left '#[fg=magenta]» #[fg=blue,bold]#T#[default]'
set-option -g status-right '#[fg=red,bold][[ #(git branch) branch ]] #[fg=cyan]»» #[fg=blue,bold]###S #[fg=magenta]%R %m-%d#(acpi | cut -d ',' -f 2)#[default]'
set-option -g visual-activity on
# Titles (window number, program name, active (or not)
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T'
############################################################################
# Unbindings
############################################################################
#unbind [ # copy mode bound to escape key
unbind j
unbind C-b # unbind default leader key
unbind '"' # unbind horizontal split
unbind % # unbind vertical split
############################################################################
# Bindings
############################################################################
# reload tmux conf
bind-key r source-file ~/.tmux.conf
#bind Escape copy-mode
# new split in current pane (horizontal / vertical)
bind-key - split-window -v # split pane horizontally
bind-key \ split-window -h # split pane vertically
# list panes
bind-key Space list-panes
# break-pane
bind-key Enter break-pane
# join-pane [-dhv] [-l size | -p percentage] [-s src-pane]
# [-t:dst-window.dst-pane] (destination window (dot) destination pane
# (alias: joinp)
#
#bind C-j command-prompt "joinp"
#bind C-j command-prompt "join-pane"
#bind-key j command-prompt "join-pane -s '%%'"
#bind-key j command-prompt "joinp -t:0"
bind-key Space command-prompt "joinp -t:%%" # %% = prompt for window.pane [-V|H] # vert|hor split
#previous pane
bind-key -n C-up prev
bind-key -n C-left prev
#next pane
bind-key -n C-right next
bind-key -n C-down next
############################################################################
# windows
############################################################################
set-window-option -g window-status-current-bg red
bind C-j previous-window
bind C-k next-window
bind-key C-a last-window # C-a C-a for last active window
bind A command-prompt "rename-window %%"
# By default, all windows in a session are constrained to the size of the
# smallest client connected to that session,
# even if both clients are looking at different windows.
# It seems that in this particular case, Screen has the better default
# where a window is only constrained in size if a smaller client
# is actively looking at it.
setw -g aggressive-resize on
############################################################################
# panes
############################################################################
# Navigation ---------------------------------------------------------------
# use the vim motion keys to move between panes
# use regular ctrl+hjkl to switch between tmux and vim panes
# Requires vim to respond to ctrl+hjkl in a certain way:
# https://github.com/aaronjensen/vimfiles/blob/4299d9341ccc52443239bebff2111abe9989565e/vimrc#L468-L500
bind -n ^H run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^H) || tmux select-pane -L"
bind -n ^J run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^J) || tmux select-pane -D"
bind -n ^K run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^K) || tmux select-pane -U"
bind -n ^L run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^L) || tmux select-pane -R"
# Resizing ---------------------------------------------------------------
bind-key C-h resize-pane -L
bind-key C-j resize-pane -D
bind-key C-k resize-pane -U
bind-key C-l resize-pane -R
# use vim motion keys while in copy mode
setw -g mode-keys vi
############################################################################
# layouts
############################################################################
bind o select-layout "active-only"
bind M-- select-layout "even-vertical"
bind M-| select-layout "even-horizontal"
bind M-r rotate-window
# focus on first window
# select-window -t 0
# Faster Command Sequences
set -s escape-time 0
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"