This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot-tmux.conf
128 lines (100 loc) · 5.52 KB
/
dot-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
# vim: ft=tmux
# Upgrade $TERM
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# Address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 10
# Required (again) since macOS Sierra
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/commit/c67238179ce456fa21b047c5ae22e9ac6a9310f6
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# Increase scrollback buffer size
set -g history-limit 50000
# Do not rename windows automatically
set -g allow-rename off
# Display Tmux messages for 3 seconds
set -g display-time 3000
# Display pane numbers for half a second
set -g display-panes-time 500
# Count windows from 1
set -g base-index 1
# Use Vim-like key bindings in copy and choice mode
set -g mode-keys vi
# Use shell-like key bindings in the command prompt
set -g status-keys emacs
# Enable mouse
set -g mouse on
# Appearance
set -g status-position bottom
set -g status-justify left
set -g status-left-length 50 # Default is 10
set -g status-right-length 50 # Default is 40
set -g mode-style fg=colour255,bg=colour241
set -g message-style fg=colour255,bg=colour236
set -g status-style fg=colour255,bg=colour241
set -g status-left-style fg=colour255,bg=colour237
set -g status-right-style fg=colour255,bg=colour237
set -g status-left ' ❐ #S '
set -g status-right '#{?client_prefix, tmux ,}#{?window_zoomed_flag, Zoomed in ,} #H '
set -g window-status-separator ''
set -g window-status-format '#[fg=colour255] #I #W '
set -g window-status-current-format '#[fg=colour255,bg=colour244,bold] #W #[default]#[fg=colour255]'
set -g pane-active-border-style fg=colour241
set -g pane-border-style fg=colour241
set -g pane-border-format ' #{?pane_active,#[fg=colour166]●#[default],#{pane_index}} #{pane_current_command} '
set -g pane-border-status bottom
set -g visual-activity on
# Change prefix to C-q or C-Space
set -g prefix C-q
set -g prefix2 C-Space
unbind-key C-b
bind-key C-q send-prefix
bind-key C-Space send-prefix
# Easier and faster switching between next/prev window
bind-key C-p previous-window
bind-key C-n next-window
# New bindings for s and l (which we override below)
bind-key S choose-tree
bind-key b last-window
# Vim-like window splitting
bind-key s split-window -v
bind-key v split-window -h
# Easier and faster pane resizing
bind-key h resize-pane -L 5
bind-key l resize-pane -R 5
bind-key j resize-pane -D 5
bind-key k resize-pane -U 5
# Vim-like pane switching
bind-key C-h select-pane -L
bind-key C-j select-pane -D
bind-key C-k select-pane -U
bind-key C-l select-pane -R
# Enable seamless navigation between Vim and tmux
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
bind-key -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
bind-key -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
bind-key -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
# Allow using alt in macOS without enabling “Use Option as Meta key”
bind-key -n ˙ if-shell "$is_vim" "send-keys ˙" "select-pane -L"
bind-key -n ∆ if-shell "$is_vim" "send-keys ∆" "select-pane -D"
bind-key -n ˚ if-shell "$is_vim" "send-keys ˚" "select-pane -U"
bind-key -n ¬ if-shell "$is_vim" "send-keys ¬" "select-pane -R"
# Change window order
bind-key < swap-window -t -1
bind-key > swap-window -t +1
# Reload Tmux configuration (see `man tmux`)
bind-key R source-file ~/.tmux.conf \; display-message "Tmux configuration reloaded"
# Use Space to toggle between block/line mode instead of default v
bind-key -Tcopy-mode-vi Space send-keys -X rectangle-toggle
# Use v to start selection
unbind-key -Tcopy-mode-vi v
bind-key -Tcopy-mode-vi v send-keys -X begin-selection
# To copy a mouse selection to macOS's system clipboard, use one of the following:
# 1. In Terminal.app, press fn and drag the mouse, then use Cmd-C as usual (works also in Vim).
# 2. In iTerm2.app, press Option and drag the mouse, then use Cmd-C as usual (works also in Vim).
# 3. In any terminal, start dragging with the mouse, then, while keeping the mouse button down, press y.
# See also: https://github.com/tmux/tmux/wiki/FAQ
bind-key -Tcopy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# Toggle status line
bind-key -n S-Up set-option -g status
bind-key -n S-Down set-option -g status