-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
152 lines (123 loc) · 5.04 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
###########################
# Configuration
###########################
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# copy&paste on mac
set -g set-clipboard off
#set -g default-command "reattach-to-user-namespace -l zsh"
# increase scroll-back history
set -g history-limit 5000
# automatically decrease window numbers
set-option -g renumber-windows on
# use vim key bindings
set -g mode-keys vi
# set search highlight
set -g mode-style "fg=red,bg=blue"
set -g set-clipboard on
unbind-key Escape
bind-key Escape copy-mode
# Setup 'v' & 'V' to begin selection in copy mode.
# `\; send-keys -X rectangle-toggle` is the best thing I came up with to
# imitate original vi behavior.
unbind-key -T copy-mode-vi "v"
bind-key -T copy-mode-vi "v" send-keys -X begin-selection
unbind-key -T copy-mode-vi "V"
bind-key -T copy-mode-vi "V" send-keys -X select-line
unbind-key -T copy-mode-vi "C-v"
bind-key -T copy-mode-vi "C-v" send-keys -X begin-selection \; send-keys -X rectangle-toggle
# C-a & C-e as beggining and end of line in the copy mode.
unbind-key -T copy-mode-vi "C-a"
#bind-key -T copy-mode-vi "C-a" "send-keys -X start-of-line"
bind-key -T copy-mode-vi "C-a" send-keys -X back-to-indentation
unbind-key -T copy-mode-vi "C-e"
bind-key -T copy-mode-vi "C-e" send-keys -X end-of-line
# Enter and y for copy in copy mode.
unbind-key -T copy-mode-vi "y"
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel "pbcopy"
#unbind-key -T copy-mode-vi "Enter"
#bind-key -T copy-mode-vi "Enter" send-keys -X copy-selection-and-cancel "pbcopy"
# Copy when mouse selection ends
unbind-key -T copy-mode-vi "MouseDragEnd1Pane"
bind-key -T copy-mode-vi "MouseDragEnd1Pane" send-keys -X copy-pipe-and-cancel "pbcopy"
unbind-key -T copy-mode "MouseDragEnd1Pane"
bind-key -T copy-mode "MouseDragEnd1Pane" send-keys -X copy-pipe-and-cancel "pbcopy"
# Drag & drop windows
unbind-key -n MouseDrag1Status
bind-key -n MouseDrag1Status swap-window -d -t=
# enable mouse
setw -g mouse on
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# start window and pane numbering at 1
set -g base-index 1
set -g pane-base-index 1
# visual notification of activity in other windows
set -g monitor-activity on
set -g visual-activity on
# ------------------------------------------------------------------------------
# status line
# enable utf-8 on status bar
set-option -g status on # turn the status bar on
set-option -g status-interval 5 # set update frequency (default 15 seconds)
set-option -g status-justify left # window list position
set-option -g status-position top # position the status bar at top of screen
set-option -g status-style "fg=colour239"
set-option -g status-left '::'
set-option -g status-right ''
set-option -g status-left-length 50
set-option -g status-right-length 50
set-window-option -g window-status-current-format '#[fg=#2188ff] [#I] #T '
set-window-option -g window-status-format ' [#I] #T '
set-window-option -g window-status-separator '|'
###########################
# Key Bindings
###########################
# tmux prefix
unbind C-b
set -g prefix C-s
# go to last window
unbind C-s
bind C-s last-window
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# splitting
unbind c
bind c new-window -c "#{pane_current_path}"
unbind v
bind v split-window -h -c "#{pane_current_path}"
unbind s
bind s split-window -v -c "#{pane_current_path}"
# Session choosing
unbind S
#bind S choose-tree -NZs -O time
bind S run-shell "mux"
#bind C send-keys ls \; send-keys Enter
# Switch to previous session when the current one is destroyed.
set-option -g detach-on-destroy off
# Moving between and resizing panes
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?n?vim?(diff)?$"'
bind -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
bind -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
bind -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
bind -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
#bind -n M-\ if-shell "$is_vim" "send-keys M-\\" "select-pane -l"
# This is specific to my keyboard
bind -n M-BSpace if-shell "$is_vim" "send-keys C-w" "send-keys M-BSpace"
bind-key Z switch-client -T RESIZE
bind-key -T RESIZE k resize-pane -U \; switch-client -T RESIZE
bind-key -T RESIZE j resize-pane -D \; switch-client -T RESIZE
bind-key -T RESIZE h resize-pane -L \; switch-client -T RESIZE
bind-key -T RESIZE l resize-pane -R \; switch-client -T RESIZE
bind-key -T RESIZE K resize-pane -U 5 \; switch-client -T RESIZE
bind-key -T RESIZE J resize-pane -D 5 \; switch-client -T RESIZE
bind-key -T RESIZE H resize-pane -L 5 \; switch-client -T RESIZE
bind-key -T RESIZE L resize-pane -R 5 \; switch-client -T RESIZE
run-shell $GOPATH/src/github.com/tmux-plugins/tmux-yank/yank.tmux
run-shell $GOPATH/src/github.com/tmux-plugins/tmux-copycat/copycat.tmux