-
Notifications
You must be signed in to change notification settings - Fork 5
/
tmux.conf
126 lines (99 loc) · 3.46 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
set -g utf8
set-window-option -g utf8 on
source /Library/Python/2.7/site-packages/powerline/bindings/tmux/powerline.conf
set -g default-terminal "screen-256color"
set -g history-limit 50000
# C-b is not acceptable -- Vim uses it
set -g prefix C-s
unbind C-b
bind C-s send-prefix
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
set-window-option -g aggressive-resize on
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Highlight active window
set-window-option -g window-status-current-bg red
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Fix pbcopy/pbpaste
set-option -g default-command "reattach-to-user-namespace -l zsh"
# 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"
# hjkl pane traversal
unbind h
bind h select-pane -L
unbind j
bind j select-pane -D
unbind k
bind k select-pane -U
unbind l
bind l select-pane -R
# auto window rename
set-window-option -g automatic-rename
# auto renumber window
set-option -g renumber-windows on
# Smart pane switching with awareness of vim splits
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"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind C-l send-keys 'C-l'
bind C-k send-keys 'C-k'
############################################################################
# Mouse
############################################################################
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Toggle mouse on with prefix m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with prefix M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
############################################################################
# Unbindings
############################################################################
unbind j
unbind C-b # unbind default leader key
unbind '"' # unbind horizontal split
unbind % # unbind vertical split
unbind [ # Copy mode works as Vim
unbind p
############################################################################
# Bindings
############################################################################
bind Escape copy-mode
bind p paste-buffer
# 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