]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/tmux.conf
courge: sanoid: setup
[julm/julm-nix.git] / home-manager / profiles / tmux.conf
1 # Environment
2 # Reload the profile as a system update could have happened since tmux was launched.
3 set-environment -g -r __ETC_PROFILE_DONE
4 set-environment -g -r __NIXOS_SET_ENVIRONMENT_DONE
5 set-environment -g -r __HM_SESS_VARS_SOURCED
6
7 # Terminal
8 set -g default-terminal "screen-256color"
9 #set -g default-terminal "tmux"
10
11 # Activity
12 set -g monitor-activity off # NOTE: disabled to keep the bell working
13 set -g visual-activity off
14
15 # Bell
16 set -g bell-action any
17 set -g visual-bell off
18 #set -g bell-on-alert on
19
20 # Encoding
21 # DEPRECATED: set -g utf8 on
22 # DEPRECATED: set -g status-utf8 on
23
24 # Keys
25 set -g mode-keys vi
26 setw -g xterm-keys on
27
28 # Lower escape timing from 500ms to 50ms
29 # for quicker response to scroll-buffer access.
30 set -s escape-time 1
31
32 # Setting the prefix from C-b to C-a.
33 set -g prefix C-a
34 # Free the original Ctrl-b prefix keybinding.
35 unbind C-b
36 unbind-key C-b
37
38 # Window
39 bind C-c new-window -c "#{pane_current_path}"
40 bind C-p previous-window
41 bind p previous-window
42 bind C-n next-window
43 bind n next-window
44 bind -N 'Select window 8' 8 select-window -t:=8
45 bind -N 'Select window 10' 0 select-window -t:=10
46
47 # Buffer
48 bind Space choose-buffer
49
50 # Ensure that we can send Ctrl-a to other apps.
51 bind a send-prefix
52 bind-key a send-prefix
53
54 # Copy/Paste
55 bind Escape copy-mode
56 unbind [
57 unbind v
58 bind v paste-buffer -p
59 #bind -t vi-copy 'v' begin-selection
60 #bind -t vi-copy 'y' copy-selection
61 #bind -t vi-copy 'Space' halfpage-down
62 #bind -t vi-copy 'Bspace' halfpage-up
63
64 # Fill Copy/Paste clipboard
65 set -ga terminal-override ',rxvt-uni*:XT:Ms=\E]52;%p1%s;%p2%s\007'
66
67 # Allow xterm titles in terminal window, terminal scrolling with scrollbar,
68 # and setting overrides of C-Up, C-Down, C-Left, C-Right
69 #set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
70
71 # ICCCM clipboard
72 bind Y run "tmux save-buffer - | xclip -i -sel clipboard"
73 bind P run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer -p"
74 #bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
75 #bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"
76
77 # Reload the file with Ctrl-a+r
78 bind r source-file ~/.tmux.conf \; display "Reloaded!"
79
80 # Splitting panes
81 bind | split-window -h -c "#{pane_current_path}"
82 bind - split-window -v -c "#{pane_current_path}"
83
84 # Moving between panes
85 bind j select-pane -L
86 bind k select-pane -D
87 bind i select-pane -U
88 bind l select-pane -R
89
90 # Moving between windows
91 bind -r C-j select-window -t :-
92 bind -r C-l select-window -t :+
93 bind-key C-a last-window
94
95 # Pane resizing
96 bind -r J resize-pane -L 5
97 bind -r K resize-pane -D 5
98 bind -r I resize-pane -U 5
99 bind -r L resize-pane -R 5
100 # Set current window pane to 80 columns
101 bind-key 8 resize-pane -x 80
102
103 # Maximize and restore a pane
104 unbind Up
105 bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
106 unbind Down
107 bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
108
109 # Log output to a text file on demand.
110 #bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
111
112 #
113 ## Mouse
114 ###
115 set -g mouse on
116 # DEPRECATED: set -g mode-mouse on
117 # DEPRECATED: set -g mouse-select-pane on
118 # DEPRECATED: set -g mouse-resize-pane on
119 # DEPRECATED: set -g mouse-select-window on
120
121 bind-key m set -g mouse on \; display 'Mouse: ON'
122 bind-key M set -g mouse off \; display 'Mouse: OFF'
123
124 # tmux < 2.5
125 #bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'
126 # tmux >= 2.5
127 #bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
128
129 # To copy, left click and drag to highlight text in yellow,
130 # once you release left click yellow text will disappear and will automatically be available in clibboard
131 # Update default binding of `Enter` to also use copy-pipe
132 #unbind -T copy-mode-vi Enter
133 #bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
134 #bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
135
136 # Mouse scroll
137 # see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
138 #bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
139 #bind -n WheelDownPane select-pane -t= \; send-keys -M
140 #bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
141 #bind -t vi-copy C-WheelUpPane halfpage-up
142 #bind -t vi-copy C-WheelDownPane halfpage-down
143
144 #bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
145 #bind -n WheelDownPane select-pane -t= \; send-keys -M
146 #bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
147 #bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up
148 #bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down
149 #bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up
150 #bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
151
152 #
153 ## Style
154 ###
155
156 # pane
157 set -g pane-base-index 1
158 set -g pane-border-style 'fg=green,bg=black'
159 set -g pane-active-border-style 'fg=white,bg=yellow'
160 set -g pane-border-style 'fg=colour245'
161 set -g pane-active-border-style 'bg=colour39'
162 set -g pane-active-border-style 'fg=green,bg=black'
163 set -g pane-border-style 'fg=white,bg=black'
164 #set -g pane-border-status bottom
165 #set -g pane-border-format " #P: #{pane_current_command} "
166 #set -g pane-border-format " #P: #{pane_current_path} "
167
168 # window
169 setw -g base-index 1
170 setw -g aggressive-resize on
171 setw -g window-size latest
172 setw -g window-status-activity-style 'fg=yellow'
173 setw -g window-status-bell-style 'fg=red'
174 setw -g window-status-current-format "#I #W "
175 setw -g window-status-current-style 'fg=white'
176 setw -g window-status-format "#I #W "
177 setw -g window-status-style 'fg=blue,bg=black'
178
179 # window title
180 setw -g set-titles on
181 setw -g set-titles-string "#T"
182 setw -g allow-rename on
183 setw -g automatic-rename off
184 #set -g automatic-rename-format '#{b:pane_current_path}'
185
186 # message
187 set -g message-style 'fg=black,bg=green'
188
189 # status
190 set -g status-left-length 52
191 set -g status-right-length 451
192 set -g status-justify left
193 set -g status-style 'fg=white,bg=black'
194 set -g status-left-length 40
195 set -g status-right-length 80
196 set -g status-left ""
197 set -g status-right '#[fg=red]#h'
198 #set -g status-interval 5
199 #set -g status-justify centre
200
201 # Solarized color.
202 #source-file ~/.tmux/vendor/tmux-colors-solarized/tmuxcolors.conf
203
204 # plugins
205 ## List of plugins
206 #set -g @plugin 'tmux-plugins/tpm'
207 #set -g @plugin 'tmux-plugins/tmux-sensible'
208 #set -g @plugin 'tmux-plugins/tmux-yank'
209 #set -g @yank_selection 'clipboard' # 'primary', or 'secondary' or 'clipboard'
210
211 # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
212 #run -b '~/.tmux/plugins/tpm/tpm'
213