-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
165 lines (122 loc) · 4.78 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
155
156
157
158
159
160
161
162
163
164
165
# Bindings {{{
# Remap prefix
unbind C-b
set -g prefix C-Space
# Quick key for moving back to the previous window
bind-key L last-window
# Vim style bindings for pane movement
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
# Fix issue with tmux repeating -r the arrow directions (meaning when you switch panes you can accidentally jump back to the other pane again)
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
# Make splitting windows easier and keep the current path
bind-key v split-window -h -c '#{pane_current_path}'
bind-key s split-window -v -c '#{pane_current_path}'
# New window keeps the current path
bind-key c new-window -c "#{pane_current_path}"
# New fish window keeps the current path
bind-key C new-window -c "#{pane_current_path}" fish
# New zsh window keeps the current path
bind-key 'M-c' new-window -c "#{pane_current_path}" zsh
# Kill a window with X
bind-key X confirm-before -p "kill-window #W? (y/n)" kill-window
# Reload tmux config
# Same as in command mode :source-file ~/tmux.conf
# Or outside of tmux with `tmux source-file ~/tmux.conf`
bind-key r source-file ~/.tmux.conf
# Allow Ctrl+k to clear the history
bind-key -n C-k clear-history
# Make resizing panes easier
bind-key < resize-pane -L 5
bind-key > resize-pane -R 5
bind-key + resize-pane -U 5
bind-key - resize-pane -D 5
bind-key = select-layout even-vertical
bind-key | select-layout even-horizontal
# Maximize the current panel
bind M new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
# Return the maximized panel to normal size
bind N last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# Save the screen contents into a log file
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# Move the current window left or right with
# control+shif+left/right
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
### vim-tmux-navigator ###
# 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"
# Clear screen with ctrl-space ctrl-l because of vim-tmux navigation binding ctrl-l
bind C-l send-keys 'C-l'
# List the directory in the current path and select with tmux
# binding prefix + c + f
bind-key 'M-f' run "tmux split-window -p 40 'tmux send-keys -t #{pane_id} \"$( ls #{pane_current_path} | fzf -m | paste -sd\\ -)\"'"
bind-key 0 run "tmux split-window -l 12 'bash -ci ftpane.sh'"
bind-key 'F' run "tmux new-window 'bash -ci fpp'"
# }}}
# Settings {{{
# Tmux status line on top
set-option -g status-position top
# Ensure terminal starts with its own colour scheme (defined below)
set -g default-terminal "screen-256color"
# 24 hour clock
setw -g clock-mode-style 24
# Note: if you have EDITOR=vim set
# then the following two settings aren't needed
# Use Vi style key bindings to move around command line mode
set-option -g status-keys vi
# Use Vi style key bindings to move around copy mode
setw -g mode-keys vi
# Remove delay when pressing esc in Vim
set -sg escape-time 0
# Prevent tmux from renaming the tab when processes change
set-option -g allow-rename off
# Set base to 1
set -g base-index 1
set -g pane-base-index 1
set -g status on
# Increase scrollback lines
set -g history-limit 30000
# Renumber windows automatically after removing a window
set-option -g renumber-windows on
# Connect the system buffer and tmux
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
# Mouse support (resizing, selecting, ...)
set -g mouse on
# }}}
# Plugins {{{
# Plugins manager
set -g @plugin 'tmux-plugins/tpm'
# Tmux themes
set -g @plugin 'jimeh/tmux-themepack'
# Resurrect tmux sessions
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Open files from tmux
set -g @plugin 'tmux-plugins/tmux-open'
# Tmux search
set -g @plugin 'tmux-plugins/tmux-copycat'
# Prefix highlight
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Copy to clipboard
set -g @plugin 'tmux-plugins/tmux-yank'
# Sidebar
set -g @plugin 'tmux-plugins/tmux-sidebar'
# }}}
# Theme {{{
# Basic theme is used from themepack
# source-file "${HOME}/.tmux/themes/sdark.tmuxtheme"
#}}}
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'