Browse Source

Added tmux config

master
Kim Grytøyr 3 months ago
parent
commit
910cc9563e
Signed by: Kim Grytøyr <kim@grytoyr.io> GPG Key ID: 759EF8C94E0B45B7
2 changed files with 137 additions and 0 deletions
  1. 13
    0
      tmux/all-servers.conf
  2. 124
    0
      tmux/tmux.conf

+ 13
- 0
tmux/all-servers.conf View File

@@ -0,0 +1,13 @@
1
+neww -n allprod
2
+split-window
3
+split-window
4
+select-pane -U
5
+select-pane -U
6
+select-layout even-vertical
7
+send-keys -t allprod "ssh prod-osl2" C-m
8
+select-pane -D
9
+send-keys -t allprod "ssh prod-osl3" C-m
10
+select-pane -D
11
+send-keys -t allprod "ssh prod-osl4" C-m
12
+setw synchronize-panes on
13
+display-message "Panes synchronized.."

+ 124
- 0
tmux/tmux.conf View File

@@ -0,0 +1,124 @@
1
+set-option -g default-command "reattach-to-user-namespace -l zsh"
2
+set -g mouse on
3
+set-option -g default-shell /bin/zsh
4
+
5
+# Key bindings
6
+bind r source-file ${HOME}/.tmux.conf \; display-message "tmux config reloaded"
7
+
8
+# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
9
+set-option -g status-bg colour235 #base02
10
+set-option -g status-fg colour136 #yellow
11
+set-option -g status-attr default
12
+
13
+# set window split
14
+#bind-key v split-window -h
15
+#bind-key b split-window
16
+
17
+# default window title colors
18
+set-window-option -g window-status-fg colour244 #base0
19
+set-window-option -g window-status-bg default
20
+#set-window-option -g window-status-attr dim
21
+
22
+# active window title colors
23
+set-window-option -g window-status-current-fg colour166 #orange
24
+set-window-option -g window-status-current-bg default
25
+#set-window-option -g window-status-current-attr bright
26
+
27
+# pane border
28
+set-option -g pane-border-fg colour235 #base02
29
+set-option -g pane-active-border-fg colour240 #base01
30
+
31
+# message text
32
+set-option -g message-bg colour235 #base02
33
+set-option -g message-fg colour166 #orange
34
+
35
+# pane number display
36
+set-option -g display-panes-active-colour colour33 #blue
37
+set-option -g display-panes-colour colour166 #orange
38
+# clock
39
+set-window-option -g clock-mode-colour green #green
40
+
41
+
42
+set -g status-interval 1
43
+set -g status-justify centre # center align window list
44
+set -g status-left-length 20
45
+set -g status-right-length 140
46
+set -g status-left '#[fg=green]#H #[fg=black]• #[fg=green,bright]#(uname -r | cut -c 1-6)#[default]'
47
+set -g status-right '#[fg=green,bg=default,bright]#(tmux-mem-cpu-load --mem-mode 2) #[fg=red,bg=default]#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") #[fg=white,bg=default]%H:%M:%S#[default] #[fg=blue]%Y-%m-%d'
48
+
49
+# Start numbering at 1
50
+set -g base-index 1
51
+
52
+# Allows for faster key repetition
53
+set -s escape-time 0
54
+
55
+# Rather than constraining window size to the maximum size of any client
56
+# connected to the *session*, constrain window size to the maximum size of any
57
+# client connected to *that window*. Much more reasonable.
58
+setw -g aggressive-resize on
59
+
60
+# Allows us to use C-a a <command> to send commands to a TMUX session inside
61
+# another TMUX session
62
+#bind-key a send-prefix
63
+
64
+# Activity monitoring
65
+setw -g monitor-activity on
66
+set -g visual-activity on
67
+
68
+# Vi copypaste mode
69
+set-window-option -g mode-keys vi
70
+bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
71
+bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
72
+bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
73
+
74
+# All servers conf
75
+bind a source-file ~/.tmux/all-servers.conf
76
+
77
+# hjkl pane traversal
78
+bind h select-pane -L
79
+bind j select-pane -D
80
+bind k select-pane -U
81
+bind l select-pane -R
82
+
83
+bind ( setw synchronize-panes on \; display-message "Panes synchronized.."
84
+bind ) setw synchronize-panes off \; display-message "Panes no longer synchronized.."
85
+
86
+# set to main-horizontal, 60% height for main pane
87
+#bind m set-window-option main-pane-height 60\; select-layout main-horizontal
88
+
89
+#bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
90
+
91
+# reload config
92
+bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
93
+
94
+# auto window rename
95
+#set-window-option -g automatic-rename
96
+
97
+# color
98
+set -g default-terminal "screen-256color"
99
+
100
+# https://github.com/edkolev/dots/blob/master/tmux.conf
101
+# Updates for tmux 1.9's current pane splitting paths.
102
+
103
+# from powerline
104
+run-shell "tmux set-environment -g TMUX_VERSION_MAJOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f1 | sed 's/[^0-9]*//g')"
105
+run-shell "tmux set-environment -g TMUX_VERSION_MINOR $(tmux -V | cut -d' ' -f2 | cut -d'.' -f2 | sed 's/[^0-9]*//g')"
106
+
107
+# status bar
108
+if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 2\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set-option -g status-utf8 on'
109
+
110
+# rm mouse mode fail
111
+if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 1\)' 'set -g mouse off'
112
+if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 1\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set -g mode-mouse off'
113
+
114
+# fix pane_current_path on new window and splits
115
+if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind c; bind c new-window -c "#{pane_current_path}"'
116
+if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" "unbind '\"'; bind '\"' split-window -v -c '#{pane_current_path}'"
117
+if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind v; bind v split-window -h -c "#{pane_current_path}"'
118
+if-shell "test '#{$TMUX_VERSION_MAJOR} -gt 1 -o \( #{$TMUX_VERSION_MAJOR} -eq 1 -a #{$TMUX_VERSION_MINOR} -ge 8 \)'" 'unbind %; bind % split-window -h -c "#{pane_current_path}"'
119
+
120
+set -g @plugin 'tmux-plugins/tpm'
121
+set -g @plugin 'tmux-plugins/tmux-resurrect'
122
+
123
+run '~/.tmux/plugins/tpm/tpm'
124
+#run-shell ~/dev/tmux-resurrect/resurrect.tmux

Loading…
Cancel
Save