-
Notifications
You must be signed in to change notification settings - Fork 10
/
.tmux.conf
126 lines (100 loc) · 3.99 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
# To install:
#
# 1. Install https://github.com/thewtex/tmux-mem-cpu-load/ (optional)
# 2. Need a fresh clone of tmux plugin manager, tpm:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# 3. Use M-[ I to install plugins
#
# Useful commands/shortcuts:
# - Use M-[ u to update plugins
# - Use M-: resize-pane -x 105 to resize panes
# - Use M-: select-layout even-horizontal to evenly distribute panes
# horizontally
# Color terminal
set -g default-terminal "xterm-256color"
set-window-option -g xterm-keys on
# reload ~/.tmux.conf using PREFIX r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
set -g history-limit 10000
# Monitor activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# For pinentry support we need to update the DBUS address
set-option -g update-environment 'DBUS_SESSION_BUS_ADDRESS'
############################################################################
# Status Bar
############################################################################
set -g status-justify centre
# grey status bar with cyan writing
set-option -g status-bg colour235
set-option -g status-fg cyan
set-option -g status-interval 5
set-option -g status-left-length 30
set-option -g status-right-length 140
# [Session Name:Window Index:Pane Index]
set-option -g status-left '#{prefix_highlight}[#[fg=green]#S#[fg=cyan]:\
#[fg=yellow]#I#[fg=cyan]:#[fg=magenta]#P#[fg=cyan]]'
# Use a series of variables to assemble the right side of status line
nils_date="%a %h-%d %H:%M"
# Uses tmux-mem-cpu-load: https://github.com/thewtex/tmux-mem-cpu-load
nils_tmux_mem_cpu_load="#(which tmux-mem-cpu-load)"
%if "#{==:#{nils_tmux_mem_cpu_load},}"
nils_mem=""
%else
nils_mem="#(`which tmux-mem-cpu-load` -c -q -g 0 -t 0 -a 0 -i 3)"
%endif
# grab the temp from lm-sensors
nils_temp="#(sensors | sed 's/Tctl:/Core 0:/' | \
awk -v format=\" T: %2.1fC |\" '/^Core [0-9]+/ {gsub(\"[^0-9.]\", \"\", $3); \
sum+=$3; n+=1} END {printf(format, sum/n)}')"
# If there's nothing remaining in the battery, we probably don't have one :)
%if "#{==:#{battery_remain},}"
nils_batt=""
%else
nils_batt="B:#{battery_icon} #{battery_percentage} #{battery_remain} |"
%endif
set -g status-right "$nils_mem |$nils_temp$nils_batt #H | $nils_date "
# Change name at the bottom of current window to always see what is being run.
setw -g automatic-rename on
# Set the title of the terminal window to the automatic name
set-option -g set-titles on
# Enable navigating
# set -g mouse on
# Use non-Emacs shortcut for sending prefix
# unbind C-b
set -g prefix M-[
# Allow pasting from the system using prefix C-y
bind-key -T prefix C-y run "xsel -o -b | tmux load-buffer - ; tmux paste-buffer"
# Allow copying from inside tmux to the system clipboard
bind-key -T copy-mode C-w send-keys -X copy-pipe-and-cancel "xsel -i --clipboard"
bind-key -T copy-mode M-w send-keys -X copy-pipe-and-cancel "xsel -i --clipboard"
# Plugin manager:
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sensible'
# Battery status indicator
set -g @plugin 'tmux-plugins/tmux-battery'
# CPU monitoring
set -g @plugin 'tmux-plugins/tmux-cpu'
# copycat plugin
set -g @plugin 'tmux-plugins/tmux-copycat'
# tmux-yank plugin
set -g @plugin 'tmux-plugins/tmux-yank'
# tmux-open, o opens, C-o in $EDITOR
set -g @plugin 'tmux-plugins/tmux-open'
# show if prefix is active in bar
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Show whether we are connected to the internet or not
set -g @plugin 'tmux-plugins/tmux-online-status'
# set only on OS X where it's required
# set -g default-command "reattach-to-user-namespace -l $SHELL"
# auto save and auto restore sessions
# Load the main plugins
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Enable restore last environment on start
set -g @continuum-restore 'on'
# Start tmux on boot
set -g @continuum-boot 'off'
# set -g @continuum-boot-options 'iterm'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'