snowflake/user/subs/tmux.nix
2025-06-05 13:14:10 +08:00

63 lines
1.7 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.subs.tmux;
in { options.subs.tmux = {
enable = lib.mkOption {
default = false;
type = lib.types.bool;
};
};
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
package = pkgs.tmux;
baseIndex = 1;
mouse = true;
prefix = "C-Space";
terminal = "xterm-256color";
plugins = with pkgs.tmuxPlugins; [
{
plugin = yank;
extraConfig = ''
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
'';
}
{
plugin = tmux-fzf;
extraConfig = ''
TMUX_FZF_LAUNCH_KEY="z"
TMUX_FZF_PREVIEW=0
TMUX_FZF_ORDER="session|window|pane|command|keybinding"
'';
}
{
plugin = dracula;
extraConfig = ''
set -g @dracula-plugins "cwd ssh-session"
set -g @dracula-show-left-icon "#S"
set -g @dracula-show-powerline false
set -g @dracula-border-contrast true
'';
}
];
extraConfig = ''
set -sg escape-time 10
set -g focus-events on
set -sa terminal-features ",xterm-256color:RGB"
set -g status-position top
set -g status-left-length 50
set -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
'';
};
};
}