-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
149 lines (129 loc) · 5.84 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
################################################
# Common tmux settings for all OSes.
# At end of this, .tmux.platform.conf is sourced
################################################
# Set tmux prefix to Ctrl-a and unbind the default Ctrl-b prefix
set -g prefix C-a
unbind C-b
# Ctrl-a is the prefix. To send Ctrl-a to programs (such as vim) inside
# tmux use Ctrl-a Ctrl-a
bind C-a send-prefix
set-option -sa terminal-overrides ',xterm-256color:RGB'
set-option -a terminal-features 'XXX:RGB'
set-option -g focus-events on
# reduce the delay inbetween tmux commands so that it doesn't interfer with
# entering vim keystrokes right away after changing tmux panes/windows
set -sg escape-time 1
# The base index for windows and panes to 1 instead of the default 0.
# Now prefix 1 is the first window instead of a prefix 0 being the first.
set -g base-index 1
setw -g pane-base-index 1
# Reload tmux.conf with prefix-r
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# Set the term environment variable when using tmux
# https://github.com/tmux/tmux/issues/3218
# $ /usr/local/Cellar/ncurses/6.3/bin/infocmp -x tmux-256color >tmux-256color.src
# $ sudo /usr/bin/tic -x tmux-256color.src
# https://github.com/Homebrew/homebrew-core/issues/102748#issuecomment-1145383249
# set -g default-terminal "tmux-256color"
set -g default-terminal "screen-256color"
# bind | and - to horizontal and vertical split respectively.
# | and - is easier to remember because of the visual symbolism.
# \ is for when I forget to type shift to get |
# Not necessarily easier to type though... so may consider another binding
bind | split-window -h
# On newer versions of tmux built from src, \ needs to be escaped like: bind \\ split-window -h
# On older builds I could use: bind \ split-window -h
# It works when surrounded by quotes too
bind '\' split-window -h
bind - split-window -v
# bind movements between panes to h,j,k,l
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# bind movements between windows to Ctrl-h and Ctrl-l (left,right)
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# bind resizing of panes to H,J,K,L (resizes by steps of 5 lines/columns)
# Note, bindings are repeatable (within the default 500ms time limit) so that
# you don't have to keep entering the prefix. (Prefix-H-H-H resizes by 15)
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# copy/paste bindings
# Escape to switch to copy mode
# v to start visual mode
# V to start visual mode (Visual Line)
# Ctrl-v to toggle visual block
# y to yank selected text into copy buffer
# p to paste text from buffer
# Escape to exit copy mode
# use vi movements when working inside the tmux buffer
# See <prefix>-:list-keys -t copy-mode-vi
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
#By default use vi keys is copy and choice modes
setw -g mode-keys vi
# #These are defined in copy-mode-vi and vi-choice table respectively
# bind -t copy-mode-vi 'v' begin-selection
# bind -t copy-mode-vi 'V' select-line
# bind -t copy-mode-vi 'y' copy-selection
# bind -t copy-mode-vi 'C-v' rectangle-toggle
# bind -t copy-mode-vi Escape cancel
# New: https://github.com/tmux/tmux/issues/754
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi y ; bind-key -T copy-mode-vi y send-keys -X copy-selection
unbind-key -T copy-mode-vi Escape ; bind-key -T copy-mode-vi Escape send-keys -X cancel
# select-line is V by default
#Use vi keys in tmux status (command) line (<prefix>-:)
#These are defined in vi-edit table
setw -g status-keys vi
# Enable mouse in tmux.
# =====================
# Note, mouse mode was rewritten in tmux v2.1 and there are no longer options for mouse-resize-pane,
# mouse-select-pane, mmouse-select-window and mode-mouse.
# I used to have logic for tmux settings depending on version. But this broke when tmux is built
# from git master branch because `tmux -V` returns "tmux master"... the logic is difficult to maintain
# and I now always use a current version of tmux... so I eliminated the logic.
set -g mouse on
#m toggles mouse on/off and displays state
bind m set -g mouse \; display "Mouse is #{?#{mouse},on,off}"
setw -g xterm-keys on
# toggle to last window like screen
bind-key C-x last-window
# Status bar Settings
# Variable Description
# -------- -----------
# #H Hostname of local host
# #h Hostname of local host without the domain name #F Current window flag
# #I Current window index
# #P Current pane index
# #S Current session name
# #T Current window title
# #W Current window name
# ## A literal #
# #(shell-command) First line of the shell command’s output #[attributes] Color or attribute change
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%d %b %R"
#if tmux version >= 2.0 and < 2.2
# turn on utf-8 support for statusline in case I want to use utf-8 in status line in future
if-shell '[ $TMUX_VERSION_MAJOR -ge 2 -a $TMUX_VERSION_MINOR -lt 2 ]' "\
set -g status-utf8 on "
# refresh status line every 60 seconds (this is sufficient to keep time current) (don't set this too low)
set -g status-interval 60
# provide visual notification in status bar when a window's content changes
setw -g monitor-activity on
set -g visual-activity on
# Center the window list
set -g status-justify centre
#Finally source settings specific to platform
source-file ~/.tmux.platform.conf
source-file ~/.tmux.solarizeddark.conf