This repository has been archived by the owner on Jul 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tmux.conf
154 lines (121 loc) · 4.47 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
# config
# set the default shell
# set -g default-command "reattach-to-user-namespace -l $HOME/software/bin/zsh"
if-shell "uname | grep -q Linux" "set -g default-command $HOME/software/bin/zsh"
# vi-style controls for copy mode
setw -g mode-keys vi
#-------------------------------------------------------------------------------
# key bindings
# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix
# bind Alt-Left, etc. to zsh functions "dirhistory_back", etc.
bind -n M-Left send-key "\e[3D"
bind -n M-Right send-key "\e[3C"
bind -n M-Up send-key "\e[3A"
bind -n M-Down send-key "\e[3B"
# new window ^C c
unbind ^C
unbind c
bind ^C new-window
bind c new-window
# detach ^D d
unbind ^D
bind ^D detach
# title A
unbind A
bind A command-prompt "rename-window %%"
# other ^A
unbind ^A
bind ^A last-window
# toggle synchronize-panes
unbind e
bind e setw synchronize-panes
# splitting windows
unbind %
bind | split-window -h
bind - split-window -v
# 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"
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
# smart pane switching with awareness of vim splits
# bind -n C-k run-shell 'tmux-vim-select-pane -U'
# bind -n C-j run-shell 'tmux-vim-select-pane -D'
# bind -n C-h run-shell 'tmux-vim-select-pane -L'
# bind -n C-l run-shell 'tmux-vim-select-pane -R'
# bind -n "C-\\" run-shell 'tmux-vim-select-pane -l'
# resize panes
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# bring back clear screen and "kill rest of line" under tmux prefix
bind C-l send-keys 'C-l'
bind C-k send-keys 'C-k'
# get rid of the kill-window binding. It's just annoying
unbind k
# split the main window into three panes
bind C-P source ~/.tmux-scripts/split_window_into_three
# get rid of the annoying binding on C-A space ("next layout") and replace it
# with "next-window", as for C-A C-space
unbind space
bind space next-window
bind C-space next-window
# toggle pane labels
bind C-t run-shell 'tmux set -g pane-border-status'
# "pop" and "unpop" the active pane from the current window
# bind Z run-shell ~/.tmux-scripts/pop.sh
#-------------------------------------------------------------------------------
# appearance
# background colour for status bar
set -g status-bg colour243
# highlight current window
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-fg white
# status line contents
set-window-option -g status-left "Screens:"
set-window-option -g status-right ' session "#S" on "#{=21:pane_title}" %H:%M %d-%b-%y '
set-window-option -g status-right-length 55
set-window-option -g window-status-format " #I #W "
set-window-option -g window-status-current-format " #I #W "
# label each pane with its number and the command that it's running
set -g pane-border-format "#{pane_index} #{pane_current_command}"
# set -g pane-border-status top
# make status messages visible for longer than the default 750ms
set-option -g display-time 4000
# enable mouse scrolling
set -g mouse on
# set-window-option -g mode-mouse on
# set-window-option -g mouse-select-pane on
# set-window-option -g mouse-resize-pane on
# set-window-option -g mouse-select-window on
# wire in the tmux-yank plugin
set -g @yank_selection "primary"
#-------------------------------------------------------------------------------
# plugin manager configuration
# List of plugins
# Supports `github_username/repo` or full git repo URLs
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-yank \
'
# Other examples:
# github_username/plugin_name \
# [email protected]/user/plugin \
# [email protected]/user/plugin \
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell '~/.tmux/plugins/tpm/tpm'