nix-config/modules/tmux/default.nix
2026-01-29 10:45:31 +01:00

116 lines
3.3 KiB
Nix

{ pkgs, ... }:
let
tmux-compile = pkgs.tmuxPlugins.mkTmuxPlugin {
pluginName = "compile-mode";
version = "1.0";
src = pkgs.fetchFromGitHub {
owner = "alexekdahl";
repo = "tmux-compile";
rev = "be830d944a189fc6b209490fcb815346a3c402ca";
hash = "sha256-+b3Oc4M0xhwCo7HupAJpG68ZxMC8yMNZLl6QtEQv12o=";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
postPatch = ''
patchShebangs .
'';
postInstall = ''
for script in $target/share/tmux-plugins/*/bin/* $target/share/tmux-plugins/*/*.tmux; do
[ -f "$script" ] && [ -x "$script" ] && wrapProgram "$script" \
--prefix PATH : ${
pkgs.lib.makeBinPath [
pkgs.bash
pkgs.coreutils
pkgs.tmux
pkgs.gnused
pkgs.gnugrep
]
}
done
'';
};
in
{
programs.tmux = {
enable = true;
package = pkgs.tmux;
baseIndex = 1;
clock24 = true;
disableConfirmationPrompt = true;
mouse = true;
newSession = true;
prefix = "C-b";
shell = "${pkgs.fish}/bin/fish";
terminal = "screen-256color";
keyMode = "vi";
escapeTime = 0;
plugins = with pkgs; [
{
plugin = tmuxPlugins.resurrect;
extraConfig = ''
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
'';
}
{
plugin = tmuxPlugins.continuum;
extraConfig = ''
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-save-interval '10'
'';
}
];
extraConfig = ''
set -g status-position top
set -g status-style bg=#1d202f,fg=white
set -g status-left ""
set -g status-right "#[bg=default,fg=magenta]>> #S << #[bg=default,fg=white]#H "
set-window-option -g window-status-style 'fg=magenta,bg=#1d202f'
set-window-option -g window-status-format ' #I #[fg=white]#W #[fg=cyan]#F '
set-window-option -g window-status-current-style "fg=black,bg=magenta"
set-window-option -g window-status-current-format " #I #W #F "
set -g pane-border-style fg=#807c9f
set -g pane-active-border-style fg=magenta
set -g message-style "fg=black,bg=red,bold"
unbind %
bind "|" split-window -h
unbind '"'
bind - split-window -l 15 -v
bind r source-file "~/.config/tmux/tmux.conf"
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind ? list-keys -a
unbind s
bind s display-popup -h 50% -w 80% -E sessionizer
unbind C-x
bind C-x kill-session
unbind v
bind v choose-tree -Zw "join-pane -t '%%'"
# Custom plugins
set -g @compile-mode-key "C-b"
set -g @compile-mode-recompile-key "C-r"
set -g @compile-mode-kill-key "C-k"
set -g @compile-mode-height "30%"
set -g @compile-mode-history-file "$HOME/.config/tmux-compile-mode/compile-history"
set -g @compile-mode-open-file-key "Enter"
run-shell ${tmux-compile}/share/tmux-plugins/compile-mode/compile-mode.tmux
'';
};
}