87 lines
3.2 KiB
Nix
87 lines
3.2 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
cfg = config.dot.tmux;
|
|
in
|
|
{
|
|
options.dot.tmux = {
|
|
workMode = lib.mkEnableOption "work-specific tmux configuration";
|
|
};
|
|
|
|
config = {
|
|
programs.tmux = {
|
|
enable = true;
|
|
shortcut = "a";
|
|
mouse = true;
|
|
keyMode = "vi";
|
|
escapeTime = 10;
|
|
terminal = "screen-256color";
|
|
tmuxp.enable = true;
|
|
extraConfig = ''
|
|
set -g display-time 1500
|
|
|
|
unbind S
|
|
bind S command-prompt "switch -t %1"
|
|
bind-key , command-prompt -p "rename-window:" "rename-window '%%'"
|
|
|
|
# Check if we are in vim
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|
|
|
bind-key -n C-M-h if-shell "$is_vim" { send-keys C-M-h } { if -F "#{pane_at_left}" "previous-window" "select-pane -L" }
|
|
bind-key -n C-M-j if-shell "$is_vim" { send-keys C-M-j } { if -F "#{pane_at_bottom}" "switch-client -n" "select-pane -D" }
|
|
bind-key -n C-M-k if-shell "$is_vim" { send-keys C-M-k } { if -F "#{pane_at_top}" "switch-client -p" "select-pane -U" }
|
|
bind-key -n C-M-l if-shell "$is_vim" { send-keys C-M-l } { if -F "#{pane_at_right}" "next-window" "select-pane -R" }
|
|
|
|
bind '"' split-window -c "#{pane_current_path}"
|
|
bind % split-window -h -c "#{pane_current_path}"
|
|
bind c new-window -a -c "#{pane_current_path}"
|
|
|
|
bind C-g display-popup -E -d "#{pane_current_path}" -xC -yC -w 95% -h 95% "lazygit"
|
|
bind C-t display-popup -E -xC -yC -w 95% -h 95% "tasksquire"
|
|
|
|
${lib.optionalString cfg.workMode ''
|
|
bind C-s display-popup -E "zsh ~/bin/tmuxp_selector.sh"
|
|
bind C-n display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/" "vim quick_notes.md"
|
|
bind C-p display-popup -E -xC -yC -w 95% -h 95% -d "~/Documents/notes/Work/development/" "vim mbpr.md"
|
|
''}
|
|
|
|
#######################################
|
|
# status line
|
|
#######################################
|
|
set -g status-justify centre
|
|
|
|
set -g status-left "#[bg=#808080,fg=#ffffff,bold] #S #[default]#[bg=#BCBCBC] #{-30:pane_title} "
|
|
set -g status-left-length 40
|
|
|
|
set -g status-right "#[bg=#BCBCBC] %H:%M #[bg=#808080,fg=#ffffff] %d.%m.%y "
|
|
|
|
# setw -g window-status-format " #W#F "
|
|
# setw -g window-status-current-format " #W#F "
|
|
setw -g window-status-format " #W "
|
|
setw -g window-status-current-format " #W "
|
|
setw -g window-status-separator ""
|
|
|
|
#######################################
|
|
# colors, taken from vim-lucius
|
|
#######################################
|
|
set -g status-style "bg=#DADADA,fg=#000000"
|
|
|
|
setw -g window-status-style "bg=#BCBCBC,fg=#000000"
|
|
setw -g window-status-current-style "bg=#808080,fg=#ffffff"
|
|
|
|
setw -g window-status-activity-style "bg=#AFD7AF,fg=#000000"
|
|
setw -g window-status-bell-style "bg=#AFD7AF,fg=#000000"
|
|
#setw -g window-status-content-style "bg=#AFD7AF,fg=#000000"
|
|
|
|
set -g pane-active-border-style "bg=#eeeeee,fg=#006699"
|
|
set -g pane-border-style "bg=#eeeeee,fg=#999999"
|
|
'';
|
|
};
|
|
|
|
home.shellAliases = {
|
|
"o" = "tmuxp";
|
|
"ol" = "tmuxp load";
|
|
};
|
|
};
|
|
}
|