-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
100 lines (76 loc) · 3.21 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
# improve colors
set -g default-terminal 'screen-256color'
# act like vim
setw -g mode-keys vi
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Ctrl-s prefix key.
set -g prefix C-s
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color from harsh green to light gray
set -g status-bg '#666666'
set -g status-fg '#aaaaaa'
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# prefix -> back-one-character
bind-key C-b send-prefix
# prefix-2 -> forward-incremental-history-search
bind-key C-s send-prefix -2
# don't suspend-client
unbind-key C-z
# Reload tmux.conf with prefix-r
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# Set the session name in the status bar
set-option -g status-left "[#S]"
set-option -g status-left-length 30
# Make Vim responsive to esc
set -s escape-time 0
# More intuitive keybindings for splitting
bind-key - split-window -v -c "#{pane_current_path}"
bind-key '\' split-window -h -c "#{pane_current_path}"
# Open new windows at the current directory
bind c new-window -c "#{pane_current_path}"
# Vim-like keybindings for pane switching, with awareness of vim splits
# See this blog post for additional detail:
# http://robots.thoughtbot.com/post/53022241323/seamlessly-navigate-vim-and-tmux-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"
# Restore default prefix-l to switch to last window
bind-key l last-window
# Setup "v" and "V" to begin selection as in Vim
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe "pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe "pbcopy"
# Additional binding for copy mode
bind-key -T copy-mode-vi Escape send -X cancel
# Bind resizing of panes to {Shift,Ctrl}-{Left,Right,Up,Down}
# Shift resizes in smaller increments, Ctrl in larger increments
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1
bind -n C-Left resize-pane -L 10
bind -n C-Right resize-pane -R 10
bind -n C-Down resize-pane -D 5
bind -n C-Up resize-pane -U 5
# Detach the current pane into a new background window
bind-key b break-pane -d
# "break session" and "kill session" without exiting tmux
bind-key C-b send-keys "tat && exit" "C-m"
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
# Make C-j display a selectable list of sessions
bind C-j choose-tree -s