confix/modules/home-manager/tmux.nix

57 lines
1.7 KiB
Nix

{ pkgs, config, ... }:
{
programs.tmux = {
enable = true;
baseIndex = 1;
prefix = "C-b";
mouse = false;
extraConfig = ''
# Do not rename windows automatically
set-option -g allow-rename off
# Hide statusbar while using one window
set -g status off
set-hook -g after-new-window 'if "[ #{session_windows} -gt 1 ]" "set status on"'
set-hook -g after-kill-pane 'if "[ #{session_windows} -lt 2 ]" "set status off"'
set-hook -g pane-exited 'if "[ #{session_windows} -lt 2 ]" "set status off"'
set-hook -g window-layout-changed 'if "[ #{session_windows} -lt 2 ]" "set status off"'
# Reload tmux.conf
unbind r
bind r source-file $HOME/.config/tmux/tmux.conf \; display "tmux config reloaded"
# Rebind vertical/horizontal splitting
unbind %
unbind v
bind v split-window -h -c "#{pane_current_path}"
unbind '"'
unbind c
bind c split-window -v -c "#{pane_current_path}"
unbind Enter
bind Enter new-window
unbind Tab
bind Tab last-window
unbind l
# Rebind moving panes
bind -n C-h select-pane -L
bind -n C-j select-pane -D
bind -n C-k select-pane -U
bind -n C-l select-pane -R
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
set -g status-position top
set -g status-left "[#S] "
set -g status-right "#{=21:pane_title}"
set -g status-style "bg=#282a36 fg=#f8f8f2"
setw -g window-status-current-style "bg=#BD93F9 fg=#282a36"
setw -g window-status-current-format " #I:#W #F "
setw -g window-status-format "#I:#W #F"
'';
};
}