feat(home-manager): add tmux sessions with script

This commit is contained in:
Yorick Barbanneau 2025-05-02 16:47:35 +02:00
parent d77c22221c
commit 5e6fbc9eba
2 changed files with 163 additions and 3 deletions

View file

@ -7,8 +7,17 @@ in
{
options.modules.cli.tmux = {
enable = mkEnableOption "enable Tmux";
extraConfig = mkOption {
type = types.lines;
default = '''';
description = ''
user related Tmux options, wee be concatenated with options defined
in the module.
'';
};
};
config = mkIf cfg.enable {
home.file.".local/bin/create-tmux-session".source = ./files/create-tmux-session.sh;
programs.tmux = {
enable = true;
aggressiveResize = true;
@ -21,6 +30,8 @@ in
prefix = "C-a";
terminal = "tmux-256color";
extraConfig = ''
set -g detach-on-destroy off
set -g display-time 1500
bind -n -N "Select pane to the left of the active pane" M-h select-pane -L
bind -n -N "Select pane below the active pane" M-j select-pane -D
@ -31,8 +42,10 @@ in
bind -n -r -N "Resize the pane down by 5" M-J resize-pane -D 5
bind -n -r -N "Resize the pane up by 5" M-K resize-pane -U 5
bind -n -r -N "Resize the pane right by 5" M-L resize-pane -R 5
bind -n -n M-n split-window -h -c "#{pane_current_path}"
bind -n -n M-N split-window -v -c "#{pane_current_path}"
bind -n M-n split-window -h -c "#{pane_current_path}"
bind -n M-N split-window -v -c "#{pane_current_path}"
bind -n M-0 run 'create-tmux-session -s config -p nix "run:nvim ." vsplit'
# Theme
set -g status-interval 2
@ -58,7 +71,7 @@ in
set -g status-left-length 100
set -g status-left '#[bg=colour0, fg=colour6]  #S '
set -g status-right ' '
'';
'' + cfg.extraConfig;
plugins = with pkgs; [
tmuxPlugins.tmux-fzf
];