feat(programs): add tmux

This commit is contained in:
Moritz Böhme 2023-04-25 18:55:15 +02:00
parent 69454aba52
commit 52650a3c84
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
9 changed files with 67 additions and 1 deletions

View file

@ -25,6 +25,7 @@
./ssh.nix
./sway.nix
./thunar.nix
./tmux.nix
./zathura.nix
./zsh.nix
];

49
modules/programs/tmux.nix Normal file
View file

@ -0,0 +1,49 @@
{ 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
'';
};
};
}