| ... | ... | @@ -0,0 +1,107 @@ |
| 1 | { pkgs, config, ... }: |
| 2 | let |
| 3 | tmux-nvim = pkgs.tmuxPlugins.mkTmuxPlugin { |
| 4 | pluginName = "tmux.nvim"; |
| 5 | version = "unstable-2025-05-19"; |
| 6 | src = pkgs.fetchFromGitHub { |
| 7 | owner = "aserowy"; |
| 8 | repo = "tmux.nvim/"; |
| 9 | rev = "2c1c3be0ef287073cef963f2aefa31a15c8b9cd8"; |
| 10 | sha256 = "sha256-/XIjqQr9loWVTXZDaZx2bSQgco46z7yam50dCnM5p1U="; |
| 11 | }; |
| 12 | }; |
| 13 | |
| 14 | in |
| 15 | { |
| 16 | programs.tmux = { |
| 17 | enable = true; |
| 18 | mouse = true; |
| 19 | |
| 20 | shell = "${pkgs.fish}/bin/fish"; |
| 21 | |
| 22 | shortcut = "a"; |
| 23 | keyMode = "vi"; |
| 24 | |
| 25 | plugins = with pkgs.tmuxPlugins; [ |
| 26 | better-mouse-mode |
| 27 | tmux-nvim |
| 28 | tmux-thumbs |
| 29 | cpu |
| 30 | tmux-floax |
| 31 | yank |
| 32 | # must be before continuum edits right status bar |
| 33 | { |
| 34 | plugin = catppuccin; |
| 35 | extraConfig = '' |
| 36 | set -g @catppuccin_flavour "mocha" |
| 37 | set -g @catppuccin_window_status_style "rounded" |
| 38 | |
| 39 | set -g status-right-length 100 |
| 40 | set -g status-left-length 100 |
| 41 | set -g status-left "" |
| 42 | set -g status-right "#{E:@catppuccin_status_application}" |
| 43 | set -ag status-right "#{E:@catppuccin_status_session}" |
| 44 | set -ag status-right "#{E:@catppuccin_status_uptime}" |
| 45 | |
| 46 | ''; |
| 47 | } |
| 48 | { |
| 49 | plugin = resurrect; |
| 50 | extraConfig = '' |
| 51 | set -g @resurrect-strategy-vim 'session' |
| 52 | set -g @resurrect-strategy-nvim 'session' |
| 53 | set -g @resurrect-capture-pane-contents 'on' |
| 54 | '' |
| 55 | + '' |
| 56 | # Taken from: https://github.com/p3t33/nixos_flake/blob/5a989e5af403b4efe296be6f39ffe6d5d440d6d6/home/modules/tmux.nix |
| 57 | resurrect_dir="$XDG_CACHE_HOME/.tmux/resurrect" |
| 58 | set -g @resurrect-dir $resurrect_dir |
| 59 | |
| 60 | set -g @resurrect-hook-post-save-all 'target=$(readlink -f $resurrect_dir/last); sed "s| --cmd .*-vim-pack-dir||g; s|/etc/profiles/per-user/$USER/bin/||g; s|/home/$USER/.nix-profile/bin/||g" $target | sponge $target' |
| 61 | ''; |
| 62 | |
| 63 | } |
| 64 | { |
| 65 | plugin = continuum; |
| 66 | extraConfig = '' |
| 67 | set -g @continuum-restore 'on' |
| 68 | set -g @continuum-boot 'on' |
| 69 | set -g @continuum-save-interval '10' |
| 70 | set -g @continuum-systemd-start-cmd 'start-server' |
| 71 | ''; |
| 72 | } |
| 73 | |
| 74 | ]; |
| 75 | extraConfig = '' |
| 76 | set -g default-terminal "tmux-256color" |
| 77 | set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.local/share/tmux/plugins' |
| 78 | # Easier reload of config |
| 79 | bind r source-file ~/.config/tmux/tmux.conf |
| 80 | # Quicker escape in neovim |
| 81 | set -sg escape-time 0 |
| 82 | set-option -g set-titles on |
| 83 | set-option -g set-titles-string "#S / #W" |
| 84 | |
| 85 | set -g allow-passthrough on |
| 86 | |
| 87 | # '@pane-is-vim' is a pane-local option that is set by the plugin on load, |
| 88 | # and unset when Neovim exits or suspends; note that this means you'll probably |
| 89 | # not want to lazy-load smart-splits.nvim, as the variable won't be set until |
| 90 | # the plugin is loaded |
| 91 | |
| 92 | # Smart pane switching with awareness of Neovim splits. |
| 93 | bind-key -n C-h if -F "#{@pane-is-vim}" 'send-keys C-h' 'select-pane -L' |
| 94 | bind-key -n C-j if -F "#{@pane-is-vim}" 'send-keys C-j' 'select-pane -D' |
| 95 | bind-key -n C-k if -F "#{@pane-is-vim}" 'send-keys C-k' 'select-pane -U' |
| 96 | bind-key -n C-l if -F "#{@pane-is-vim}" 'send-keys C-l' 'select-pane -R' |
| 97 | |
| 98 | # Smart pane resizing with awareness of Neovim splits. |
| 99 | bind-key -n M-h if -F "#{@pane-is-vim}" 'send-keys M-h' 'resize-pane -L 3' |
| 100 | bind-key -n M-j if -F "#{@pane-is-vim}" 'send-keys M-j' 'resize-pane -D 3' |
| 101 | bind-key -n M-k if -F "#{@pane-is-vim}" 'send-keys M-k' 'resize-pane -U 3' |
| 102 | bind-key -n M-l if -F "#{@pane-is-vim}" 'send-keys M-l' 'resize-pane -R 3' |
| 103 | |
| 104 | ''; |
| 105 | }; |
| 106 | |
| 107 | } |