nixos-combined-flake/modules/home-manager/shell/tmux/default.nix

108 lines
4.4 KiB
Nix

{ pkgs, lib, config, ... }:
{
options = { };
config = {
programs.tmux = lib.mkIf config.programs.tmux.enable {
newSession = false;
mouse = true;
keyMode = "vi";
historyLimit = 10240;
clock24 = true;
baseIndex = 1;
aggressiveResize = true;
shortcut = "a";
sensibleOnTop = true;
escapeTime = 0;
tmuxp.enable = true;
plugins = with pkgs.tmuxPlugins; [
sensible
yank
{
plugin = catppuccin;
extraConfig = ''
set -g @catppuccin_flavour "mocha"
set -g @catppuccin_window_status_style "rounded"
set -g @catppuccin_window_default_text " #W" # use "#W" for application instead of directory
set -g @catppuccin_window_current_text " #W" # use "#W" for application instead of directory
set -g @catppuccin_window_status "icon"
set -g @catppuccin_window_separator ""
set -g @catppuccin_window_middle_separator ""
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator ""
set -g @catppuccin_window_status_enable "yes"
set -g @catppuccin_icon_window_last "󰖰 "
set -g @catppuccin_icon_window_current "󰖯 "
set -g @catppuccin_icon_window_zoom "󰁌 "
set -g @catppuccin_icon_window_mark "󰃀 "
set -g @catppuccin_icon_window_silent "󰂛 "
set -g @catppuccin_icon_window_activity "󱅫 "
set -g @catppuccin_icon_window_bell "󰂞 "
#set -g @catppuccin_window_status_enable "yes"
set -g @catppuccin_status_modules_right "directory user host date_time session"
set -g status-right-length 100
#set -g status-right "#{E:@catppuccin_status_directory}"
#set -ag status-right "#{E:@catppuccin_status_user}"
#set -ag status-right "#{E:@catppuccin_status_host}"
#set -ag status-right "#{E:@catppuccin_status_date_time}"
#set -agF status-right "#{E:@catppuccin_status_session}"
set -g status-left ""
'';
}
better-mouse-mode
{
plugin = tmux-fzf;
extraConfig = ''
unbind A
TMUX_FZF_LAUNCH_KEY="f"
TMUX_FZF_PANE_FORMAT="[#{window_name}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}"
'';
}
];
extraConfig = ''
# Quick pane cycling
unbind ^A
bind ^A last-window
#unbind 'Space'
#bind 'Space' next-window
bind-key C-s split-window -v
bind-key C-v split-window -h
set -g renumber-windows on
# Open new panes and windows with the current panes path
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
set-option -sa terminal-features ',xterm-256color:RGB'
set-option -sa terminal-features ',st-256color:RGB'
set-option -sa terminal-features ',xterm-kitty:RGB'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind-key -T copy-mode-vi 'C-h' 'select-pane -L'
bind-key -T copy-mode-vi 'C-j' 'select-pane -D'
bind-key -T copy-mode-vi 'C-k' 'select-pane -U'
bind-key -T copy-mode-vi 'C-l' 'select-pane -R'
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
bind-key -T copy-mode-vi M-h resize-pane -L 1
bind-key -T copy-mode-vi M-j resize-pane -D 1
bind-key -T copy-mode-vi M-k resize-pane -U 1
bind-key -T copy-mode-vi M-l resize-pane -R 1
'';
};
};
}