nixos/home/modules/tmux.nix

53 lines
1.4 KiB
Nix

{ lib, config, pkgs, ... }:
let
inherit (lib) getExe optionalString;
cfg = config.snowhawk.tmux;
sessionizer = cfg.sessionizer;
macos = config.snowhawk.macos.enable;
in
{
options.snowhawk.tmux = {
enable = lib.mkEnableOption "tmux";
};
config = lib.mkIf cfg.enable {
programs.tmux = {
enable = true;
shell = getExe (if macos then pkgs.zsh else pkgs.fish);
mouse = true;
baseIndex = 1;
terminal = "screen-256color";
newSession = true;
escapeTime = 0;
plugins = with pkgs; [
{
plugin = tmuxPlugins.rose-pine;
extraConfig = ''
set -g @rose_pine_variant 'main' # Options are 'main', 'moon' or 'dawn'
set -g @rose_pine_host 'on'
set -g @rose_pine_date_time '%c' # %c is a good value but
'';
}
{ plugin = tmuxPlugins.vim-tmux-navigator; }
];
extraConfig = ''
set-option -g renumber-windows on
set-option -g focus-events on
set-option -g terminal-features 'alacritty:RGB'
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
'' + optionalString sessionizer.enable ''
bind-key -r f run-shell "tmux neww ${getExe sessionizer.pkg}"
'';
};
programs.fish.shellAbbrs = {
a = "tmux a";
};
};
}