1{ lib, config, pkgs, ... } @ inputs:
2
3with lib;
4let
5 inherit (pkgs) stdenv;
6 inherit (import ../../lib/colors.nix inputs) colors;
7
8 cfg = config.modules.git;
9
10 defaultActiveColor = colors.yellow.gui;
11 defaultInactiveColor = colors.muted.gui;
12 defaultFeatureColor = colors.blue.gui;
13 defaultBorderColor = colors.green.gui;
14 defaultSplitColor = colors.split.gui;
15in {
16 options.modules.tmux = {
17 enable = mkOption {
18 default = true;
19 description = "Tmux Configuration";
20 type = types.bool;
21 };
22 };
23
24 config = mkIf cfg.enable {
25 programs.tmux = {
26 enable = true;
27 aggressiveResize = true;
28 baseIndex = 1;
29 escapeTime = 0;
30 historyLimit = 5000;
31 keyMode = "vi";
32 shortcut = "a";
33 terminal = "xterm-256color";
34 sensibleOnTop = false;
35
36 secureSocket = stdenv.hostPlatform.isLinux;
37
38 plugins = [ ];
39
40 extraConfig = ''
41 set -g mouse on
42 set -g set-clipboard on
43
44 set-option -g focus-events on
45
46 set -g status-left-length 32
47 set -g status-right-length 150
48 set -g status-interval 5
49
50 set-option -ga terminal-overrides ",xterm-256color*:Tc:smso"
51
52 set-option -g status-style fg="${defaultActiveColor}",bg=default
53
54 set-window-option -g window-status-style fg="${defaultInactiveColor}",bg=default
55 set-window-option -g aggressive-resize on
56 set-window-option -g window-status-current-style fg="${defaultActiveColor}",bg=default
57 set-window-option -g window-status-current-format "#[bold]#I #W"
58 set-option -g pane-border-style fg="${defaultInactiveColor}"
59 set-option -g pane-active-border-style fg="${defaultBorderColor}"
60 set-option -g message-style fg="${defaultActiveColor}",bg=default
61 set-option -g display-panes-active-colour "${defaultActiveColor}"
62 set-option -g display-panes-colour "${defaultInactiveColor}"
63 set-window-option -g clock-mode-colour "${defaultActiveColor}"
64
65 set -g window-status-format "#I #W"
66
67 set -g status-left "#[fg=${defaultFeatureColor},bold]#S "
68 set -g status-right "#[fg=${defaultInactiveColor}] %R %d %b"
69
70 set -g pane-border-style fg="${defaultSplitColor}",bg="${defaultSplitColor}"
71 set -g pane-active-border-style fg="${defaultSplitColor}",bg="${defaultSplitColor}"
72
73 unbind C-p
74 bind C-p paste-buffer
75
76 bind -n C-h select-pane -L
77 bind -n C-j select-pane -D
78 bind -n C-k select-pane -U
79 bind -n C-l select-pane -R
80
81 bind -r h resize-pane -L 2
82 bind -r j resize-pane -D 2
83 bind -r k resize-pane -U 2
84 bind -r l resize-pane -R 2
85
86 bind b kill-pane
87 '';
88 };
89
90 programs.zsh.shellAliases = mkIf config.modules.shell.enable {
91 ta = "tmux attach -t";
92 ts = "tmux new-session -s";
93 tl = "tmux list-sessions";
94 tksv = "tmux kill-server";
95 tkss = "tmux kill-session -t";
96 };
97 };
98}