about summary refs log tree commit diff
path: root/config/tmux/config.nix
blob: d62a472bc1d8396ee95512589688fffb3260c2e8 (plain) (blame)
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
{ stdenv, writeText, writeShellScriptBin
, coreutils, extract_url, reattach-to-user-namespace, ruby, tmux, zsh }:

''
set -gw activity-action none
set -g  allow-rename off
set -g  base-index 1
${if stdenv.isDarwin then ''
  set -g default-command "${reattach-to-user-namespace}/bin/reattach-to-user-namespace -l ${zsh}/bin/zsh"
'' else ''
  set -g default-command "${zsh}/bin/zsh -l"
''}
set -gs default-terminal screen-256color
set -s  escape-time 0
set -gw mode-keys vi
set -gw monitor-activity on
set -g  mouse on
set -gw pane-active-border-style fg=default,bright
set -gw pane-base-index 1
set -gw pane-border-format ' #{pane_current_command} '
set -gw pane-border-status top
set -g  prefix C-a
set -g  renumber-windows on
set -g  status-left ""
set -g  status-position top
set -g  status-right ""
set -ga status-right " #{?client_prefix, #[bright]#{prefix}#[nobright] ,}"
# set -ga status-right ' #(cd #{pane_current_path} && zsh -c "print -P %%~") '
# set -ga status-right '#(head="$(git -C #{pane_current_path} rev-parse --abbrev-ref HEAD 2>/dev/null)" && echo " $head ")'
# set -ga status-right ' #(pmset -g batt | grep -o \\d*%%) '
set -ga status-right " %d-%b-%y %H:%M"
set -g  status-right-length 200
set -g  status-style bg=default,fg=default
set -gw window-status-style fg=default
set -gw window-status-activity-style fg=default,underscore
set -gw window-status-bell-style fg=brightcyan
set -gw window-status-current-format '#W'
set -gw window-status-current-style bright
set -gw window-status-format '#W'
set -gw window-status-separator '  '

bind -n   F1  select-window -t :1
bind -n   F2  select-window -t :2
bind -n   F3  select-window -t :3
bind -n   F4  select-window -t :4
bind -n   F5  select-window -t :5
bind -n   F6  select-window -t :6
bind -n   F7  select-window -t :7
bind -n   F8  select-window -t :8
bind -n   F9  select-window -t :9
bind -n   F10 select-window -t :10
bind -n   F11 select-window -t :11
bind -n   F12 select-window -t :12
bind -n S-F1  select-window -t :13
bind -n S-F2  select-window -t :14
bind -n S-F3  select-window -t :15
bind -n S-F4  select-window -t :16
bind -n S-F5  select-window -t :17
bind -n S-F6  select-window -t :18
bind -n S-F7  select-window -t :19
bind -n S-F8  select-window -t :20

bind -n C-l send-keys C-l \; run-shell "sleep 0.3" \; clear-history
bind    C-l send-keys -R \; clear-history

bind '"' split-window -v -c '#{pane_current_path}'
bind  %  split-window -h -c '#{pane_current_path}'

bind C-a send-prefix

unbind C-b

set-hook -g after-select-pane "refresh-client -S"
set-hook -g alert-activity "refresh-client -S"

bind u run ${writeShellScriptBin "tmux-url" ''
set -ue
buffer="$(mktemp -t tmux-buffer)"
open=${writeText "tmux-open-url.rb" ''
#!${ruby}/bin/ruby
require "cgi"
exec "/usr/bin/open", CGI.unescape(ARGV[0]), *ARGV[1..-1]
''}
${tmux}/bin/tmux capture-pane -J
${tmux}/bin/tmux save-buffer "$buffer"
${tmux}/bin/tmux split-window -l 10 -f "${coreutils}/bin/tac $buffer | BROWSER=\"$open\"i ${extract_url}/bin/extract_url"
''}/bin/tmux-url

# bind u run "~/.config/tmux/url.sh"
''