105 lines
3.6 KiB
Nix
105 lines
3.6 KiB
Nix
{ pkgs, ... }:
|
|
|
|
{
|
|
programs.tmux = {
|
|
enable = true;
|
|
terminal = "screen-256color"; # Ensures proper color support
|
|
shell = "${pkgs.zsh}/bin/zsh"; # Forces tmux to use Zsh by default
|
|
clock24 = true;
|
|
|
|
plugins = with pkgs.tmuxPlugins; [
|
|
vim-tmux-navigator
|
|
{
|
|
plugin = rose-pine;
|
|
extraConfig = ''
|
|
set -g @rose_pine_variant 'main'
|
|
set -g @rose_pine_host 'on'
|
|
set -g @rose_pine_user 'on'
|
|
set -g @rose_pine_directory 'on'
|
|
set -g @rose_pine_date_time '%a %b %d %H:%M:%S %Y'
|
|
set -g @rose_pine_left_separator ' > '
|
|
set -g @rose_pine_right_separator ' < '
|
|
set -g @rose_pine_field_separator ' | '
|
|
set -g @rose_pine_window_separator ' - '
|
|
set -g @rose_pine_window_status_separator " "
|
|
set -g @rose_pine_hostname_icon ''
|
|
set -g @rose_pine_date_time_icon ''
|
|
'';
|
|
}
|
|
{
|
|
plugin = resurrect;
|
|
extraConfig = ''
|
|
# Resurrect Configuration - Save/restore tmux sessions with all details
|
|
set -g @resurrect-strategy-nvim 'session'
|
|
set -g @resurrect-strategy-vim 'session'
|
|
set -g @resurrect-strategy-pane 'bash'
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
set -g @resurrect-processes 'nvim vim ssh "~zsh" "~bash" opencode ranger fzf'
|
|
set -g @resurrect-dir '$HOME/.local/share/tmux/resurrect'
|
|
# Save command history in panes
|
|
set -g @resurrect-save-shell-history 'on'
|
|
'';
|
|
}
|
|
{
|
|
plugin = continuum;
|
|
extraConfig = ''
|
|
# Continuum Configuration - Automatically save and restore sessions
|
|
set -g @continuum-restore 'on'
|
|
set -g @continuum-save-interval '5' # Save every 5 minutes for better persistence
|
|
set -g @continuum-boot 'on' # Start tmux automatically on boot
|
|
set -g @continuum-boot-options 'new-session -d -s main' # Create default session on boot
|
|
'';
|
|
}
|
|
];
|
|
|
|
extraConfig = ''
|
|
# Basic terminal setup
|
|
set -g default-terminal "screen-256color"
|
|
set-option -ga terminal-overrides ",xterm-256color:Tc"
|
|
set-option -g default-command "zsh -l"
|
|
setw -g mode-keys vi
|
|
set -g base-index 1
|
|
set -g pane-base-index 1
|
|
set -g status-position top
|
|
set -g status-style "bg=default"
|
|
|
|
# Pane navigation
|
|
bind-key h select-pane -L
|
|
bind-key j select-pane -D
|
|
bind-key k select-pane -U
|
|
bind-key l select-pane -R
|
|
bind-key % split-window -h -c "#{pane_current_path}"
|
|
bind-key '"' split-window -v -c "#{pane_current_path}"
|
|
bind-key c new-window -c "#{pane_current_path}"
|
|
|
|
# Prefix key
|
|
set -g prefix C-s
|
|
bind C-s send-prefix
|
|
|
|
# Session management keybindings
|
|
bind-key n new-session -d # Create new session
|
|
bind-key C-n new-session # Create and attach new session
|
|
bind-key C-l list-sessions # List all sessions
|
|
bind-key C-d kill-session # Delete current session
|
|
|
|
# Enable mouse and scrollback
|
|
set -g mouse on
|
|
setw -g history-limit 10000
|
|
|
|
# Automatic system clipboard copy for selections
|
|
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "wl-copy"
|
|
bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "wl-copy"
|
|
|
|
# Create resurrect directory if it doesn't exist
|
|
run-shell 'mkdir -p ~/.local/share/tmux/resurrect'
|
|
|
|
# Pywal support - Load AFTER plugins so colors override rose-pine
|
|
if-shell "test -f ~/.cache/wal/colors-tmux.sh" \
|
|
"source-file ~/.cache/wal/colors-tmux.sh"
|
|
# Watch for updates
|
|
run-shell "while inotifywait -e close_write ~/.cache/wal/colors-tmux.sh 2>/dev/null; do tmux source-file ~/.cache/wal/colors-tmux.sh; done &"
|
|
'';
|
|
};
|
|
}
|
|
|