0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-12 05:16:25 +03:00

Merge pull request #222080 from Stunkymonkey/nixos-optionalString

This commit is contained in:
Artturi 2023-04-20 16:07:30 +03:00 committed by GitHub
commit b83db86a9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 89 additions and 95 deletions

View file

@ -11,7 +11,7 @@ let
${concatStringsSep "\n"
(mapAttrsToList (command: action: "${command} ${action}") cfg.commands)
}
${if cfg.clearDefaultCommands then "#stop" else ""}
${optionalString cfg.clearDefaultCommands "#stop"}
#line-edit
${concatStringsSep "\n"

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
let
inherit (lib) mkOption mkIf types;
inherit (lib) mkOption mkIf types optionalString;
cfg = config.programs.tmux;
@ -17,17 +17,17 @@ let
set -g base-index ${toString cfg.baseIndex}
setw -g pane-base-index ${toString cfg.baseIndex}
${if cfg.newSession then "new-session" else ""}
${optionalString cfg.newSession "new-session"}
${if cfg.reverseSplit then ''
${optionalString cfg.reverseSplit ''
bind v split-window -h
bind s split-window -v
'' else ""}
''}
set -g status-keys ${cfg.keyMode}
set -g mode-keys ${cfg.keyMode}
${if cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize then ''
${optionalString (cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) ''
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
@ -37,15 +37,15 @@ let
bind -r J resize-pane -D ${toString cfg.resizeAmount}
bind -r K resize-pane -U ${toString cfg.resizeAmount}
bind -r L resize-pane -R ${toString cfg.resizeAmount}
'' else ""}
''}
${if (cfg.shortcut != defaultShortcut) then ''
${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
'' else ""}
''}
setw -g aggressive-resize ${boolToStr cfg.aggressiveResize}
setw -g clock-mode-style ${if cfg.clock24 then "24" else "12"}