2024-07-29 02:46:30 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
namespace,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib) mkEnableOption;
|
2024-07-31 05:37:10 +00:00
|
|
|
inherit (pkgs) tmuxPlugins;
|
2024-07-29 02:46:30 +00:00
|
|
|
|
|
|
|
cfg = config.${namespace}.apps.tmux;
|
2024-10-06 16:15:43 +00:00
|
|
|
|
|
|
|
tmsConfig = {
|
|
|
|
display_full_path = true;
|
|
|
|
session_sort_order = "LastAttached";
|
|
|
|
search_dirs = [
|
|
|
|
{
|
|
|
|
path = "${config.home.homeDirectory}/src";
|
|
|
|
depth = 2;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-07-29 02:46:30 +00:00
|
|
|
in {
|
|
|
|
options.${namespace}.apps.tmux = {
|
|
|
|
enable = mkEnableOption "tmux";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-10-06 16:15:43 +00:00
|
|
|
home.packages = [pkgs.tmux-sessionizer];
|
|
|
|
|
2024-07-29 02:46:30 +00:00
|
|
|
programs.tmux = {
|
|
|
|
enable = true;
|
2024-08-12 02:21:41 +00:00
|
|
|
catppuccin.enable = true;
|
2024-07-29 02:46:30 +00:00
|
|
|
keyMode = "vi";
|
|
|
|
newSession = true;
|
|
|
|
sensibleOnTop = true;
|
|
|
|
terminal = "screen-256color";
|
|
|
|
|
|
|
|
plugins = [
|
|
|
|
{
|
2024-07-31 05:37:10 +00:00
|
|
|
plugin = tmuxPlugins.resurrect;
|
2024-07-29 02:46:30 +00:00
|
|
|
extraConfig = ''
|
|
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
|
|
set -g @resurrect-strategy-nvim 'session'
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2024-07-31 05:37:10 +00:00
|
|
|
plugin = tmuxPlugins.continuum;
|
2024-07-29 02:46:30 +00:00
|
|
|
extraConfig = ''
|
|
|
|
set -g @continuum-restore 'on'
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
2024-07-31 05:37:10 +00:00
|
|
|
tmuxPlugins.open
|
2024-10-06 03:47:57 +00:00
|
|
|
tmuxPlugins.pain-control
|
2024-08-12 02:51:28 +00:00
|
|
|
tmuxPlugins.tmux-fzf
|
|
|
|
tmuxPlugins.vim-tmux-navigator
|
2024-07-29 02:46:30 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
# Scrolling with mouse wheel scrolls output instead of previous commands
|
|
|
|
setw -g mouse on
|
|
|
|
|
|
|
|
# Open panes in the same directory
|
|
|
|
bind c new-window -c "#{pane_current_path}"
|
|
|
|
bind '"' split-window -c "#{pane_current_path}"
|
|
|
|
bind % split-window -h -c "#{pane_current_path}"
|
2024-10-06 16:15:43 +00:00
|
|
|
|
|
|
|
# sessionizer
|
|
|
|
bind C-o display-popup -E "${pkgs.tmux-sessionizer}/bin/tms"
|
|
|
|
bind C-j display-popup -E "${pkgs.tmux-sessionizer}/bin/tms switch"
|
|
|
|
bind C-w display-popup -E "${pkgs.tmux-sessionizer}/bin/tms windows"
|
|
|
|
bind C-s command-prompt -p "Rename active session to:" "run-shell '${pkgs.tmux-sessionizer}/bin/tms rename %1'"
|
2024-07-29 02:46:30 +00:00
|
|
|
'';
|
|
|
|
};
|
2024-10-06 16:15:43 +00:00
|
|
|
|
|
|
|
xdg.configFile."tms/config.toml".source = (pkgs.formats.toml {}).generate "tms-config" tmsConfig;
|
2024-07-29 02:46:30 +00:00
|
|
|
};
|
|
|
|
}
|