marleyos/old/home/programs/tmux.nix

151 lines
3.5 KiB
Nix
Raw Normal View History

2024-11-02 12:29:32 -07:00
{
pkgs,
config,
...
}:
{
2024-11-02 12:29:32 -07:00
programs.tmux = {
enable = true;
rose-pine = {
enable = true;
extraConfig = # tmux
''
set -g @rose_pine_host 'on'
set -g @rose_pine_directory 'on'
'';
2024-11-02 12:29:32 -07:00
};
2024-11-03 13:30:23 -08:00
terminal = "tmux-256color";
escapeTime = 0;
2024-11-02 12:29:32 -07:00
# Start window & pane numbering at 1.
baseIndex = 1;
# Vi mode.
keyMode = "vi";
customPaneNavigationAndResize = true;
mouse = true;
# Auto-spawn a new session when attaching if none exist.
newSession = true;
# Key used with Ctrl to make the prefix.
shortcut = "a";
plugins = with pkgs.tmuxPlugins; [
{
plugin = resurrect;
}
{
plugin = continuum;
extraConfig = # tmux
''
set -g @continuum-restore 'on'
'';
2024-11-02 12:29:32 -07:00
}
{
plugin = tilish;
extraConfig = # tmux
''
# Don't enforce the layout.
set -g @tilish-enforce 'none'
set -g @tilish-project "$HOME/hackin"
set -g @tilish-navigator 'on'
'';
2024-11-02 12:29:32 -07:00
}
{
plugin = vim-tmux-navigator;
}
2024-11-02 12:29:32 -07:00
yank
2024-11-03 00:10:01 -07:00
{
plugin = jump;
extraConfig = # tmux
''
set -g @jump-key 's'
'';
}
2024-11-02 12:29:32 -07:00
{
plugin = fingers;
extraConfig = # tmux
''
2024-11-03 00:10:01 -07:00
set -g @fingers-jump-key 'f'
'';
2024-11-02 12:29:32 -07:00
}
{
plugin = tmux-floax;
extraConfig = # tmux
''
set -g @floax-bind 'i'
2024-11-03 13:54:07 -08:00
set -g @floax-text-color 'white'
'';
2024-11-02 12:29:32 -07:00
}
];
extraConfig = # tmux
''
# Set repeat timeout so keys can be repeated without the prefix.
set -g repeat-time 1000
2024-11-02 12:29:32 -07:00
# Auto-renumber windows when one is deleted.
set -g renumber-windows 'on'
2024-11-02 12:29:32 -07:00
set -ag terminal-overrides ",*:RGB"
2024-11-02 12:29:32 -07:00
set -g status-position 'top'
2024-11-02 12:29:32 -07:00
### Keybindings ###
2024-11-02 12:29:32 -07:00
# Easy reload config.
bind r source-file ${config.xdg.configHome}/tmux/tmux.conf \; display-message "Reloaded config"
2024-11-02 12:29:32 -07:00
# Better split commands.
bind -N 'vsplit' | split-window -h -c "#{pane_current_path}"
bind -N 'vsplit' \\ split-window -h -c "#{pane_current_path}"
bind -N 'hsplit' - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
2024-11-02 12:29:32 -07:00
# Vi-like resizing.
bind -r -N 'Resize pane (left)' M-h resize-pane -L 5
bind -r -N 'Resize pane (down)' M-j resize-pane -D 5
bind -r -N 'Resize pane (up)' M-k resize-pane -U 5
bind -r -N 'Resize pane (right)' M-l resize-pane -R 5
2024-11-02 12:29:32 -07:00
# Even out panes.
bind -N 'Evenly distribute panes' = select-layout -E
2024-11-02 12:29:32 -07:00
# Swap panes.
bind -r -N 'Swap current pane with the next' H swap-pane -U
bind -r -N 'Swap current pane with the previous' L swap-pane -D
2024-11-02 12:29:32 -07:00
# Window switching.
bind -N 'Previous window' Left previous-window
bind -N 'Next window' Right next-window
2024-11-02 12:29:32 -07:00
# Vi copy mode.
unbind [
bind -N 'Enter normal (copy) mode' Escape copy-mode
2024-11-02 12:29:32 -07:00
bind -T copy-mode-vi ? command-prompt -p '?' 'send -X search-backward %1'
bind -T copy-mode-vi / command-prompt -p '/' 'send -X search-forward %1'
bind -T copy-mode-vi q send -X cancel
bind -T copy-mode-vi Escape if-shell -F '#{selection_present}' 'send -X clear-selection' 'send -X cancel'
'';
2024-11-02 12:29:32 -07:00
};
2024-11-10 18:49:48 -08:00
home.shellAbbrs = {
tmain = "tmux new -s main -A";
tmobile = "tmux new -s mobile -A";
};
2024-11-02 12:29:32 -07:00
}