-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
162 lines (124 loc) · 4.63 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
GRAY="#808080"
BLUE="#569CD6"
DARK_BLUE="#223E55"
RED="#FF160C"
YELLOW="#CCCC99"
BACKGROUND="#000000"
FOREGROUND="#CCCCCC"
# Automatically set window title
# set-window-option -g automatic-rename on
set-option -g set-titles on
# set -g status-keys vi
# # set -g history-limit 10000
set -g default-terminal "screen-256color"
set-option -g default-shell /bin/zsh
unbind C-l
# Prefix
unbind C-b
set-option -g prefix M-b
setw -g mode-keys vi
set -g mouse on
# setw -g monitor-activity on
# Splits
bind -n M-= split-window -h
bind -n M-- split-window -v
bind -n M-g display-popup -E "tmux new-session -A -s scratch"
bind -n M-h display-popup -E "htop"
bind -n M-m new-window
bind -n M-r command-prompt "rename-window '%%'"
################################################ Under construction
# Copy and paste
## Use vim keybindings in copy mode
# set -g set-clipboard on
set-option -g mouse on
# Do you want y to be yank and M-y to be paste? Universally? Use only one clipboard?
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind -n M-u copy-mode
# For xclip supported system
# bind -n M-y run-shell "tmux set-buffer \"$(xclip -o -sel c)\"; tmux paste-buffer"
# bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# For pbcopy supported system
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'
bind -n M-y run-shell "tmux set-buffer \"$(pbpaste)\"; tmux paste-buffer"
# bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'
# Use Enter and M-i to use internal buffer
bind-key -T copy-mode-vi Enter
bind -n M-i paste-buffer
################################################ Above construction
# Resize panes
bind-key -n M-Up resize-pane -U 5
bind-key -n M-Down resize-pane -D 5
bind-key -n M-Left resize-pane -L 5
bind-key -n M-Right resize-pane -R 5
bind -n M-f resize-pane -Z
# bind m \
# set -g mouse on \;\
# set -g resize-pane on \;\
# set -g select-pane on \;\
# set -g select-window on \;\
# display 'Mouse: ON'
# set mouse off with prefix M
# bind M \
# set -g mouse off \;\
# set -g resize-pane off \;\
# set -g select-pane off \;\
# set -g select-window off \;\
# display 'Mouse: OFF'
# No delay for escape key press
set -sg escape-time 0
# Reload tmux config
bind r source-file ~/.tmux.conf
# Switching windows
bind -n M-p previous-window
bind -n M-n next-window
bind -n M-s choose-window
# Switcing panes vim/tmux
# Use Alt-vim keys without prefix key to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# active window title colors
set-window-option -g window-status-current-style fg=RED
# set-option -g window-active-style bg=cyan
# Incremental search
bind-key -T copy-mode-vi / command-prompt -i -p "search down" "send -X search-forward-incremental \"%%%\""
bind-key -T copy-mode-vi ? command-prompt -i -p "search up" "send -X search-backward-incremental \"%%%\""
# Theme
set-option -g status-position top
set -g status-bg orange
set -g status-fg black
# Unbind
unbind '"'
unbind %
#---------------------------
# 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'
# tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
# if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
# "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
# if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
# "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
#---------------------------
## PLUGINS - prefix + I to install plugins
set -g @plugin 'tmux-plugins/tpm'
# # set -g @plugin 'christoomey/vim-tmux-navigator'
# set -g @plugin 'tmux-plugins/tmux-yank'
# About ressurect
# prefix + Ctrl + r to restore session
set -g @resurrect-save 'w'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# This should be at the very bottom
run '~/.tmux/plugins/tpm/tpm'