dotfiles/modules/programs/tmux.nix

50 lines
1.3 KiB
Nix
Raw Normal View History

2023-04-25 18:55:15 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.programs.tmux;
in
{
options.my.programs.tmux = {
enable = mkEnableOption "tmux";
autoAttach = mkEnableOption "autoAttach";
};
config = mkIf cfg.enable {
my.shell.abbreviations.t = "tmux";
home-manager.users.moritz.programs.tmux = {
enable = true;
clock24 = true;
customPaneNavigationAndResize = true;
keyMode = "vi";
mouse = true;
newSession = true;
prefix = "C-Space";
sensibleOnTop = false;
plugins = with pkgs.tmuxPlugins; [
sensible
tmux-fzf
yank
];
};
home-manager.users.moritz.programs = {
fzf.tmux.enableShellIntegration = true;
fish.interactiveShellInit =
let
insideVariables = [ "$TMUX" "$INSIDE_EMACS" "$EMACS" "$VIM" "$VSCODE_RESOLVING_ENVIRONMENT" ];
insideVariableMissing = concatStringsSep " && " (map (x: "test -z ${x}") insideVariables);
in
mkIf cfg.autoAttach
''
if ! fish_is_root_user && test "$TERM_PROGRAM" != 'vscode' && ${insideVariableMissing}
if test -z $tmux_autostarted
set -x tmux_autostarted true
tmux a
end
end
'';
};
};
}