-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
128 lines (98 loc) · 4.25 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
# use 256-color terminal with italics support
set -g default-terminal 'tmux-256color-italic'
set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'
set -g status-interval 5 # update status line every 5 seconds
setw -g mouse on # allow mouse
set -s escape-time 0 # remove escape delay
set -g prefix C-s # C-s prefix
unbind C-b # unbind old prefix
unbind C-z # don't suspend-client
set -g history-limit 200000 # increase scrollback lines
# act like vim
setw -g mode-keys vi
# move between panes with prefix hjkl. Typically, the shortcuts set up in
# vim-tmux-navigator are used instead (bind -n C-hjkl)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# change prefix c to create new window after current window
bind c new-window -a
# move between windows with prefix C-h/C-l
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# reload vim config with prefix r
bind r source-file ~/.tmux.conf\; display-message "tmux config reloaded 🌞"
# switch to latest session with prefix + space
bind-key Space switch-client -l
# reattach current session to current directory
bind C-r attach -c "#{pane_current_path}"\; display-message "Reattached 🌝"
# switch to dotfiles session with prefix a (usually set current project to b)
bind a attach -t dotfiles
# disable "release mouse drag to copy and exit copy-mode", ref: https://github.com/tmux/tmux/issues/140
# unbind-key -T copy-mode-vi MouseDragEnd1Pane
# since MouseDragEnd1Pane neither exits copy-mode nor clears selection now,
# let single click do selection clearing for us
# bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
# -- display -------------------------------------------------------------------
# set terminal window title
set -g set-titles on
set -g set-titles-string "#{session_name} [tmux]"
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -g renumber-windows on # renumber windows after closing any of them
# soften status bar color
set -g status-bg '#292838'
set -g status-fg '#c2c1cb'
# Clear screen with prefix C-p -- since vim-tmux-navigator overrides C-l
bind C-p send-keys 'C-l'
# Clear screen with C-e, simpler, no prefix
bind -n C-e send-keys 'C-l'
# -- navigation ----------------------------------------------------------------
# Make C-j display a selectable list of sessions
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Enter scroll/copy mode with prefix + u
bind u copy-mode
# split panes with '\' and '|' instead of '%' and '"'
bind '\' split-window -h
bind e split-window -h
bind | split-window -v
unbind '"'
unbind %
bind x kill-pane # kill pane without the confirm prompt
# switch windows with C-h and C-l
unbind n
unbind p
bind C-h previous-window # select previous window
bind C-l next-window # select next window
# reorder the current window with C-S left/right
bind -n C-S-Left swap-window -t -1 \; previous-window
bind -n C-S-Right swap-window -t +1 \; next-window
# select windows with Alt-number
# in iTerm, to set up, go to profiles->keys, map option to Esc+
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# # resize panes using Alt-arrow without prefix
bind -n M-Left resize-pane -L 5
bind -n M-Right resize-pane -R 5
bind -n M-Up resize-pane -U 5
bind -n M-Down resize-pane -D 5
# zoom with opt+z (also use <Leader>vz to zoom Vimux pane from Vim)
bind -n M-z resize-pane -Z
# Prefix + I -- install new plugins
# Prefix + U -- update plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-yank'
source-file ~/dotfiles/tmuxline.conf
set -g @yank_action 'copy-pipe' # or 'copy-pipe-and-cancel' for the default
# Initialize TMUX plugin manager (keep this line at very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'