-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
124 lines (97 loc) · 3.75 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
# Fastest command sequences (http://superuser.com/a/252717/65504)
set -s escape-time 0
# For nice colors
set -g default-terminal "screen-256color"
# XTerm compatibility
set -g xterm-keys on
# Vi keys in copy mode
set -g mode-keys vi
# History boost
set -g history-limit 50000
# Emacs key bindings in command prompt (prefix + :) are better than vi keys, even for vim users
set -g status-keys emacs
# Messages are displayed for 3 seconds
set -g display-time 3000
setw -g automatic-rename
# Mouse scrolling and copy/paste setting
set -g mouse on
bind -T copy-mode-vi Enter send-keys -X copy-pipe 'xclip -sel clip -i' '\;' send -X clear-selection
bind -T root MouseUp2Pane paste
unbind -n -Tcopy-mode-vi MouseDragEnd1Pane
# bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel -x\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection -x\; run "tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
# Emulate scrolling in pagers
tmux_commands_with_legacy_scroll="nano less man"
bind -T root WheelUpPane \
if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Up Up Up" "copy-mode -et="'
bind -T root WheelDownPane \
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
'send -Mt=' \
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down Down Down" "send -Mt="'
# ======================================================================================================================
# Key bindings and mappings
# ======================================================================================================================
# Prefix
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Reload the file with Prefix r
bind R source-file ~/.tmux.conf \; display "Sourced tmux.conf"
# Next and prev window like in vim
unbind C-p
bind -r C-h prev
bind -r C-l next
# New windows and panes in the same dir
bind n new-window -c "#{pane_current_path}"
bind i split-window -h -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -c "#{pane_current_path}"
# Pane switching
bind h selectp -L
bind j selectp -D
bind k selectp -U
bind l selectp -R
bind \\ selectp -l
# Pane swapping
bind H swap-pane -s {left-of}
bind J swap-pane -s {down-of}
bind K swap-pane -s {up-of}
bind L swap-pane -s {right-of}
# Resize panes with arrows
bind -r Left resize-pane -L 1
bind -r Down resize-pane -D 1
bind -r Up resize-pane -U 1
bind -r Right resize-pane -R 1
# <prefix> r to rename window
bind r command-prompt 'rename-window %%'
# ======================================================================================================================
# Status bar settings
# ======================================================================================================================
# Set status position
set-option -g status-position bottom
# Set the base index for windows and panes to 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# Renumber when window is closed
set -g renumber-windows on
# Activity monitoring
setw -g monitor-activity on
# Default statusbar colors
set -g status-bg black
set -g status-fg green
# Pane number display
set -g display-panes-active-colour cyan
set -g display-panes-colour brightblue
# Status settings
set -g status on
set -g status-interval 15
set -g status-justify centre
# Status line left side
set -g status-left-length 70
set -g @online_icon "yes"
set -g @offline_icon "no"
set -g status-left "#[fg=blue] Session: #S | Host: #H"