nixos-config/modules/shell/tmux.nix

80 lines
2.4 KiB
Nix

#
# Tmux
#
{ pkgs, ... }:
{
programs = {
tmux = {
enable = true;
terminal = "screen-256color";
escapeTime = 300;
newSession = false;
keyMode = "vi";
historyLimit = 10000;
clock24 = true;
shortcut = "Space";
baseIndex = 1;
plugins = with pkgs.tmuxPlugins; [
yank
sidebar
# {
# plugin = dracula;
# extraConfig = "
# set -g @dracula-show-powerline true
# set -g @dracula-plugins 'git cpu-usage ram-usage battery time'
# set -g @dracula-border-contrast true
# ";
# plugin = catppuccin;
# extraConfig = "
# set -g @catppuccin_flavour 'macchiato'
# set -g @catppuccin_window_tabs_enabled 'on'
# set -g @catppuccin_host 'on'
# set -g @catppuccin_user 'on'
# set -g @catppuccin_date_time '%Y-%m-%d %H:%M'
# ";
# }
];
extraConfig = ''
set -g mouse on
set-option -sa terminal-features ',alacritty:RGB'
# More friendly split pane
bind-key s split-window -h -c "#{pane_current_path}"
bind-key v split-window -v -c "#{pane_current_path}"
unbind '"'
unbind '%'
# moving between windows with vim movement keys
bind m select-pane -L
bind n select-pane -D
bind e select-pane -U
bind i select-pane -R
# moving between windows with vim movement keys
bind -r C-m select-window -t :-
bind -r C-i select-window -t :+
# Vim style X clipboard integration
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
bind-key P run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# resize panes with vim movement keys
bind -r M resize-pane -L 5
bind -r N resize-pane -D 5
bind -r E resize-pane -U 5
bind -r I resize-pane -R 5
# bindings for pane joining and breaking
bind < split-window -h \; choose-window 'kill-pane ; join-pane -hs %%'
bind > break-pane -d
run-shell ${pkgs.tmuxPlugins.sidebar}/share/tmux-plugins/sidebar/sidebar.tmux
'';
};
};
}