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
|
# Personal Tmux config file.
# Last Changed: 2020-02-15
# Author: Federico Igne <git@federicoigne.com>
# License: This file is placed in the public domain.
# {{{1 GENERAL
# Set terminal colors.
# Note to self: you changed this so many times it doesn't make any sense
# anymore. If you have problems with colors/fonts and terminal
# applications (e.g., Vim, (Neo)Mutt) come back here and tweak the
# option.
set -g default-terminal "tmux-256color"
# Increase history scrollback buffer size (st doesn't have any
# `scrollback buffer` feature so this is your only chance!)
set -g history-limit 16384 # 2**14
# TMux messages are displayed for 5 seconds
set -g display-time 5000
# Focus events enabled (if terminal supports them)
# This also integrates with the FocusGained/FocusLost Vim events. Use
# `vim-tmux-focus-events` Vim plugin to fix some issues with event
# focus.
#
# https://github.com/tmux-plugins/vim-tmux-focus-events
#
set -g focus-events on
# Set vi bindings for copymode
set -g mode-keys vi
# Enable mouse control but disable everything apart from pane resizing
# and window selection through statusbar.
set -g mouse on
unbind-key -T copy-mode MouseDown1Pane
unbind-key -T copy-mode MouseDrag1Pane
unbind-key -T copy-mode MouseDragEnd1Pane
unbind-key -T copy-mode WheelDownPane
unbind-key -T copy-mode WheelUpPane
unbind-key -T copy-mode-vi MouseDown1Pane
unbind-key -T copy-mode-vi MouseDrag1Pane
unbind-key -T copy-mode-vi MouseDragEnd1Pane
unbind-key -T copy-mode-vi WheelDownPane
unbind-key -T copy-mode-vi WheelUpPane
unbind-key -n MouseDown1Pane
#unbind-key -n MouseDown1Status
unbind-key -n MouseDown3Pane
#unbind-key -n MouseDrag1Border
unbind-key -n MouseDrag1Pane
unbind-key -n WheelDownStatus
unbind-key -n WheelUpPane
unbind-key -n WheelUpStatus
# {{{1 BINDINGS
# Prefix key (CTRL-<space>)
unbind-key C-b
set -g prefix C-Space
bind-key C-Space send-prefix
# Re-source config file ($HOME/.tmux.conf)
unbind-key r
bind-key r source-file $HOME/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# Split window vertically/horizontally
unbind-key -
bind-key - split-window -v
unbind-key |
bind-key | split-window -h
unbind-key \\
bind-key \\ split-window -h
# Create a new window. New windows are named with random animal name.
# Change `$HOME/.config/tmux/animals.txt` to change the set of names.
unbind-key c
bind-key c run 'tmux new-window -n "$(shuf -n1 $HOME/.config/tmux/animals.txt)"'
# Seamless navigation between TMux panes and special splits
# (Vim/Weechat). This works well with a Vim plugin that does the same
# from Vim perspective.
# See
# https://github.com/christoomey/vim-tmux-navigator
# for more information.
is_special="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|weechat|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_special" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_special" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_special" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_special" "send-keys C-l" "select-pane -R"
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
# In the Weechat case, we don't have a way to seemlessly jump in the
# Weechat->Tmux direction, so we need to escape the binding with
# <prefix>.
#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
# Next/Previous window
bind-key -r C-n next-window
bind-key -r C-p previous-window
# Make some copy-mode bindings more Vim-like:
# + v: start selection
# + C-v: toggle block selection
# + Enter: pipes the selected text into the clipboard (without exiting
# copy-mode)
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe "xclip -i -selection clipboard" \; send-keys -X clear-selection
# {{{1 STYLE/COLOURS
# Show statusline
set -g status on
# Set position
set -g status-position bottom
# Statusline update interval (seconds)
set -g status-interval 15
# Position of the window list
set -g status-justify right
# Main statusline style
set -g status-bg default
# Left part:
# It show the session name and "lights up" when the prefix is used.
set -g status-left ' #{?#(echo $SSH_SESSION),(#h) #{?client_prefix,#[fg=colour4],}#{client_session},#{?client_prefix,#[fg=colour3],}#{client_session}} '
set -g status-left-length 50
set -g status-left-style fg=colour8,bold
# Right part:
# Empty status to move the window list on the right.
set -g status-right ''
# Statusline window list
set -g window-status-format ' #W '
set -g window-status-style fg=colour8
set -g window-status-current-format ' #{?#(echo $SSH_SESSION),#[fg=colour4],#[fg=colour3]}#W '
# Messages and Command line
set -g message-style fg=colour15
set -g message-command-style fg=colour15
# Panes
set -g pane-border-style fg=colour15
set -g pane-active-border-style fg=colour3
|