tmux: format using nixfmt
This commit is contained in:
parent
e377556818
commit
34327e067f
1
format
1
format
|
@ -29,7 +29,6 @@ find . -name '*.nix' \
|
|||
! -path ./modules/programs/bash.nix \
|
||||
! -path ./modules/programs/gpg.nix \
|
||||
! -path ./modules/programs/ssh.nix \
|
||||
! -path ./modules/programs/tmux.nix \
|
||||
! -path ./modules/programs/zsh.nix \
|
||||
! -path ./modules/services/gpg-agent.nix \
|
||||
! -path ./modules/services/mpd.nix \
|
||||
|
|
|
@ -56,7 +56,8 @@ let
|
|||
set -g status-keys ${cfg.keyMode}
|
||||
set -g mode-keys ${cfg.keyMode}
|
||||
|
||||
${optionalString (cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) ''
|
||||
${optionalString
|
||||
(cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) ''
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
|
@ -68,21 +69,19 @@ let
|
|||
bind -r L resize-pane -R ${toString cfg.resizeAmount}
|
||||
''}
|
||||
|
||||
${if cfg.prefix != null
|
||||
then ''
|
||||
${if cfg.prefix != null then ''
|
||||
# rebind main key: ${cfg.prefix}
|
||||
unbind C-${defaultShortcut}
|
||||
set -g prefix ${cfg.prefix}
|
||||
bind ${cfg.prefix} send-prefix
|
||||
''
|
||||
else optionalString (cfg.shortcut != defaultShortcut) ''
|
||||
'' else
|
||||
optionalString (cfg.shortcut != defaultShortcut) ''
|
||||
# rebind main key: C-${cfg.shortcut}
|
||||
unbind C-${defaultShortcut}
|
||||
set -g prefix C-${cfg.shortcut}
|
||||
bind ${cfg.shortcut} send-prefix
|
||||
bind C-${cfg.shortcut} last-window
|
||||
''
|
||||
}
|
||||
''}
|
||||
|
||||
${optionalString cfg.disableConfirmationPrompt ''
|
||||
bind-key & kill-window
|
||||
|
@ -96,18 +95,16 @@ let
|
|||
'';
|
||||
|
||||
configPlugins = {
|
||||
assertions = [(
|
||||
let
|
||||
assertions = [
|
||||
(let
|
||||
hasBadPluginName = p: !(hasPrefix "tmuxplugin" (pluginName p));
|
||||
badPlugins = filter hasBadPluginName cfg.plugins;
|
||||
in
|
||||
{
|
||||
in {
|
||||
assertion = badPlugins == [ ];
|
||||
message =
|
||||
"Invalid tmux plugin (not prefixed with \"tmuxplugins\"): "
|
||||
message = ''Invalid tmux plugin (not prefixed with "tmuxplugins"): ''
|
||||
+ concatMapStringsSep ", " pluginName badPlugins;
|
||||
}
|
||||
)];
|
||||
})
|
||||
];
|
||||
|
||||
xdg.configFile."tmux/tmux.conf".text = ''
|
||||
# ============================================= #
|
||||
|
@ -118,18 +115,13 @@ let
|
|||
# ${pluginName p}
|
||||
# ---------------------
|
||||
${p.extraConfig or ""}
|
||||
run-shell ${
|
||||
if types.package.check p
|
||||
then p.rtp
|
||||
else p.plugin.rtp
|
||||
}
|
||||
run-shell ${if types.package.check p then p.rtp else p.plugin.rtp}
|
||||
'') cfg.plugins)}
|
||||
# ============================================= #
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.tmux = {
|
||||
aggressiveResize = mkOption {
|
||||
|
@ -294,8 +286,9 @@ in
|
|||
|
||||
plugins = mkOption {
|
||||
type = with types;
|
||||
listOf (either package pluginModule)
|
||||
// { description = "list of plugin packages or submodules"; };
|
||||
listOf (either package pluginModule) // {
|
||||
description = "list of plugin packages or submodules";
|
||||
};
|
||||
description = ''
|
||||
List of tmux plugins to be included at the end of your tmux
|
||||
configuration. The sensible plugin, however, is defaulted to
|
||||
|
@ -322,22 +315,22 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge ([
|
||||
config = mkIf cfg.enable (mkMerge ([
|
||||
{
|
||||
home.packages = [ cfg.package ]
|
||||
++ optional cfg.tmuxinator.enable pkgs.tmuxinator
|
||||
++ optional cfg.tmuxp.enable pkgs.tmuxp;
|
||||
}
|
||||
|
||||
{ xdg.configFile."tmux/tmux.conf".text = mkBefore tmuxConf; }
|
||||
{ xdg.configFile."tmux/tmux.conf".text = mkAfter cfg.extraConfig; }
|
||||
|
||||
(mkIf cfg.secureSocket {
|
||||
home.sessionVariables = {
|
||||
TMUX_TMPDIR = ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}'';
|
||||
};
|
||||
})
|
||||
|
||||
{ xdg.configFile."tmux/tmux.conf".text = mkBefore tmuxConf; }
|
||||
(mkIf (cfg.plugins != [ ]) configPlugins)
|
||||
{ xdg.configFile."tmux/tmux.conf".text = mkAfter cfg.extraConfig; }
|
||||
])
|
||||
);
|
||||
]));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue