Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions modules/programs/tmux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,43 +49,49 @@ let
${optionalString cfg.newSession "new-session"}

${optionalString cfg.reverseSplit ''
bind v split-window -h
bind s split-window -v
bind -N "Split the pane into two, left and right" v split-window -h
bind -N "Split the pane into two, top and bottom" s split-window -v
''}

set -g status-keys ${cfg.keyMode}
set -g mode-keys ${cfg.keyMode}

${optionalString
(cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) ''
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 ${toString cfg.resizeAmount}
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}
bind h -N "Select pane to the left of the active pane" select-pane -L
bind j -N "Select pane below the active pane" select-pane -D
bind k -N "Select pane above the active pane" select-pane -U
bind l -N "Select pane to the right of the active pane" select-pane -R

bind -r -N "Resize the pane left by ${toString cfg.resizeAmount}" \
H resize-pane -L ${toString cfg.resizeAmount}
bind -r -N "Resize the pane down by ${toString cfg.resizeAmount}" \
J resize-pane -D ${toString cfg.resizeAmount}
bind -r -N "Resize the pane up by ${toString cfg.resizeAmount}" \
K resize-pane -U ${toString cfg.resizeAmount}
bind -r -N "Resize the pane right by ${toString cfg.resizeAmount}" \
L resize-pane -R ${toString cfg.resizeAmount}
''}

${if cfg.prefix != null then ''
# rebind main key: ${cfg.prefix}
unbind C-${defaultShortcut}
set -g prefix ${cfg.prefix}
bind ${cfg.prefix} send-prefix
bind -N "Send the prefix key through to the application" \
${cfg.prefix} send-prefix
'' 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 -N "Send the prefix key through to the application" \
${cfg.shortcut} send-prefix
bind C-${cfg.shortcut} last-window
''}

${optionalString cfg.disableConfirmationPrompt ''
bind-key & kill-window
bind-key x kill-pane
bind-key -N "Kill the current window" & kill-window
bind-key -N "Kill the current pane" x kill-pane
''}

setw -g aggressive-resize ${boolToStr cfg.aggressiveResize}
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/tmux/disable-confirmation-prompt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ set -g mode-keys emacs



bind-key & kill-window
bind-key x kill-pane
bind-key -N "Kill the current window" & kill-window
bind-key -N "Kill the current pane" x kill-pane


setw -g aggressive-resize off
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/tmux/emacs-with-plugins.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ setw -g pane-base-index 0

new-session

bind v split-window -h
bind s split-window -v
bind -N "Split the pane into two, left and right" v split-window -h
bind -N "Split the pane into two, top and bottom" s split-window -v


set -g status-keys emacs
Expand Down
3 changes: 2 additions & 1 deletion tests/modules/programs/tmux/prefix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ set -g mode-keys emacs
# rebind main key: C-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
bind -N "Send the prefix key through to the application" \
C-a send-prefix



Expand Down
3 changes: 2 additions & 1 deletion tests/modules/programs/tmux/shortcut-without-prefix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ set -g mode-keys emacs
# rebind main key: C-a
unbind C-b
set -g prefix C-a
bind a send-prefix
bind -N "Send the prefix key through to the application" \
a send-prefix
bind C-a last-window


Expand Down
4 changes: 2 additions & 2 deletions tests/modules/programs/tmux/vi-all-true.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ setw -g pane-base-index 0

new-session

bind v split-window -h
bind s split-window -v
bind -N "Split the pane into two, left and right" v split-window -h
bind -N "Split the pane into two, top and bottom" s split-window -v


set -g status-keys vi
Expand Down