diff options
Diffstat (limited to 'config/tmux/config.nix')
-rw-r--r-- | config/tmux/config.nix | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/config/tmux/config.nix b/config/tmux/config.nix new file mode 100644 index 000000000000..d62a472bc1d8 --- /dev/null +++ b/config/tmux/config.nix @@ -0,0 +1,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" +'' |