programs/tmux.nix (view raw)
1{ config
2, pkgs
3, ...
4}:
5
6{
7 programs.tmux = {
8 enable = true;
9 plugins = with pkgs; [
10 {
11 plugin = tmuxPlugins.resurrect;
12 extraConfig = "set -g @resurrect-strategy-nvim 'session'";
13 }
14 ];
15 extraConfig = ''
16 set -g prefix C-q
17 set -g set-titles on
18 set-option -g set-titles-string "#T"
19 unbind-key C-b
20 bind-key C-q send-prefix
21 set -g update-environment "KEYBOARD_LAYOUT"
22
23 setw -g mode-keys vi
24
25 bind r source-file ~/.config/tmux/tmux.conf
26
27 set-option -g default-terminal xterm-256color-italic
28 set -as terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[2 q'
29 set escape-time 20
30
31 set -g mouse on
32
33 set -g base-index 1
34 setw -g pane-base-index 1
35
36 # pane binds
37 bind -n M-n select-pane -D
38 bind -n M-e select-pane -U
39 bind -n M-y select-pane -L
40 bind -n M-o select-pane -R
41 bind -n M-Up resize-pane -U 5
42 bind -n M-Down resize-pane -D 5
43 bind -n M-Left resize-pane -L 5
44 bind -n M-Right resize-pane -R 5
45
46 # window binds
47 bind -n C-M-y previous-window
48 bind -n C-M-o next-window
49 bind-key \" split-window -v -c "#{pane_current_path}"
50 bind-key c split-window -h -c "#{pane_current_path}"
51 bind-key v new-window -c "#{pane_current_path}"
52 bind-key s choose-session
53 bind-key ) swap-window -t +2
54 bind-key ( swap-window -t -1
55
56 unbind -T copy-mode MouseDragEnd1Pane
57 bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "wl-copy"
58 bind-key -T copy-mode-vi v send-keys -X begin-selection
59 bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
60 bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
61 bind P paste-buffer
62
63 # pop-up pane to open urls
64 bind-key u display-popup -E "xurls"
65
66 # statusline on top
67 set-option -g status-position top
68
69 # statusline hide / unhide
70 bind -n C-down set -q status off
71 bind -n C-up set -q status on
72 bind P paste-buffer
73
74 set-window-option -g allow-rename off
75
76 set -g pane-border-style fg=colour11
77 set -g pane-active-border-style fg=colour8
78
79 set -g status-justify right
80 set -g status-right ""
81 set -g status-left ""
82 set -g status-style "bg=colour0"
83 set -ag status-style "fg=colour7"
84
85 set -g window-status-current-format "#[fg=colour15] #W"
86 set -g window-status-format "#[fg=colour8] #W"
87
88 set -g status-left-length 100
89 set -ag status-left "#[fg=colour8]cwd #[fg=colour15]#(${pkgs.prompt}/bin/prompt cwd #{pane_current_path}) "
90 set -ag status-left "#[fg=colour8]#(${pkgs.prompt}/bin/prompt vcs #{pane_current_path}) "
91
92 # dim inactive pane
93 set -g window-style 'fg=color8,bg=default'
94 set -g window-active-style 'fg=color7,bg=default'
95 '';
96 };
97}