tmux: Disable confirmation prompt

This commit is contained in:
Sebastián Estrella 2019-06-04 06:21:20 -05:00 committed by Matthieu Coudron
parent 0db26fc3ab
commit 29824a8cf6
6 changed files with 77 additions and 0 deletions

View file

@ -65,6 +65,11 @@ let
bind C-${cfg.shortcut} last-window bind C-${cfg.shortcut} last-window
''} ''}
${optionalString cfg.disableConfirmationPrompt ''
bind-key & kill-window
bind-key x kill-pane
''}
setw -g aggressive-resize ${boolToStr cfg.aggressiveResize} setw -g aggressive-resize ${boolToStr cfg.aggressiveResize}
setw -g clock-mode-style ${if cfg.clock24 then "24" else "12"} setw -g clock-mode-style ${if cfg.clock24 then "24" else "12"}
set -s escape-time ${toString cfg.escapeTime} set -s escape-time ${toString cfg.escapeTime}
@ -109,6 +114,14 @@ in
''; '';
}; };
disableConfirmationPrompt = mkOption {
default = false;
type = types.bool;
description = ''
Disable confirmation prompt before killing a pane or window
'';
};
enable = mkEnableOption "tmux"; enable = mkEnableOption "tmux";
escapeTime = mkOption { escapeTime = mkOption {

View file

@ -3,4 +3,5 @@
tmux-not-enabled = ./not-enabled.nix; tmux-not-enabled = ./not-enabled.nix;
tmux-vi-all-true = ./vi-all-true.nix; tmux-vi-all-true = ./vi-all-true.nix;
tmux-secure-socket-enabled = ./secure-socket-enabled.nix; tmux-secure-socket-enabled = ./secure-socket-enabled.nix;
tmux-disable-confirmation-prompt = ./disable-confirmation-prompt.nix;
} }

View file

@ -0,0 +1,31 @@
# ============================================= #
# Start with defaults from the Sensible plugin #
# --------------------------------------------- #
run-shell @sensible_rtp@
# ============================================= #
set -g default-terminal "screen"
set -g base-index 0
setw -g pane-base-index 0
set -g status-keys emacs
set -g mode-keys emacs
bind-key & kill-window
bind-key x kill-pane
setw -g aggressive-resize off
setw -g clock-mode-style 12
set -s escape-time 500
set -g history-limit 2000

View file

@ -0,0 +1,28 @@
{ config, lib, pkgs, ... }:
with lib;
let
substituteExpected = path: pkgs.substituteAll {
src = path;
sensible_rtp = pkgs.tmuxPlugins.sensible.rtp;
};
in
{
config = {
programs.tmux = {
enable = true;
disableConfirmationPrompt = true;
};
nmt.script = ''
assertFileExists home-files/.tmux.conf
assertFileContent home-files/.tmux.conf \
${substituteExpected ./disable-confirmation-prompt.conf}
'';
};
}

View file

@ -21,6 +21,8 @@ set -g mode-keys emacs
setw -g aggressive-resize on setw -g aggressive-resize on
setw -g clock-mode-style 24 setw -g clock-mode-style 24
set -s escape-time 500 set -s escape-time 500

View file

@ -21,6 +21,8 @@ set -g mode-keys vi
setw -g aggressive-resize on setw -g aggressive-resize on
setw -g clock-mode-style 24 setw -g clock-mode-style 24
set -s escape-time 500 set -s escape-time 500