forked from ronakg/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
108 lines (85 loc) · 3.23 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
setw -gq utf8 on
# Ctrl-Space is my prefix
set -g prefix C-Space
bind C-space send-prefix
bind C-Space last-window
set -s escape-time 0
# Reload tmux configuration
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." \; move-window -r
# increase history limit
set -g history-limit 5000
# mouse mode on by-default
set-option -g mouse on
#setw -g aggressive-resize on
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ',xterm-256color:Tc'
setw -g xterm-keys on
setw -g focus-events on
# use PREFIX | to split window horizontally and PREFIX - to split vertically
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# visual notification of activity in other windows
set-window-option -g monitor-activity on
setw -g visual-activity off
bind-key -n M-z resize-pane -Z
# switch windows with alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# alt-tab to switch to last active window
bind-key -n M-tab last-window
# fast pane switching
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# 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
# set vi mode for copy mode
setw -g mode-keys vi
# more settings to make copy-mode more vim-like
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -Tcopy-mode-vi 'v' send -X begin-selection
bind -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "tmux save-buffer - | reattach-to-user-namespace pbcopy"
# Resize panes
bind-key -n C-S-Up resize-pane -U 5
bind-key -n C-S-Down resize-pane -D 5
bind-key -n C-S-Left resize-pane -L 10
bind-key -n C-S-Right resize-pane -R 10
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
# 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"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Move windows to left-rigth
bind-key -n M-S-Left swap-window -t -1
bind-key -n M-S-Right swap-window -t +1
bind-key s run-shell "~/.tmux/tmux_split_pane.sh --smart"
bind-key C-s command-prompt -p "Open new pane with command:" "run-shell \"~/.tmux/tmux_split_pane.sh --smart '%1'\""
# Theme
source ~/.tmux/themes/tmux.gruvbox.theme
# Plugins
set -g @plugin 'christoomey/vim-tmux-navigator'
run '~/.tmux/plugins/tpm/tpm'