From 4beae4c2e7cf61695e25ce8c52e80cd35c15f78f Mon Sep 17 00:00:00 2001 From: ooks-io Date: Thu, 8 Feb 2024 20:49:25 +1300 Subject: [PATCH] feat: basic tmux configuration --- home/modules/console/multiplexer/default.nix | 5 +- .../console/multiplexer/tmux/default.nix | 58 +++++++++++++++++++ home/modules/console/shell/fish/default.nix | 25 -------- home/profile/base/default.nix | 2 +- 4 files changed, 63 insertions(+), 27 deletions(-) create mode 100644 home/modules/console/multiplexer/tmux/default.nix diff --git a/home/modules/console/multiplexer/default.nix b/home/modules/console/multiplexer/default.nix index ce72b5f..219321c 100644 --- a/home/modules/console/multiplexer/default.nix +++ b/home/modules/console/multiplexer/default.nix @@ -3,12 +3,15 @@ imports = [ ./zellij #./screen - #./tmux + ./tmux ]; options.homeModules.console.multiplexer = { zellij = { enable = lib.mkEnableOption "Enable zellij multiplexer"; }; + tmux = { + enable = lib.mkEnableOption "Enable tmux multiplexer"; + }; }; } diff --git a/home/modules/console/multiplexer/tmux/default.nix b/home/modules/console/multiplexer/tmux/default.nix new file mode 100644 index 0000000..6af5ebe --- /dev/null +++ b/home/modules/console/multiplexer/tmux/default.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.homeModules.console.multiplexer.tmux; + inherit (config.colorscheme) colors; +in + +{ + config = lib.mkIf cfg.enable { + programs.tmux = { + enable = true; + shell = "${pkgs.fish}/bin/fish"; + prefix = "C-space"; + baseIndex = 1; + keyMode = "vi"; + escapeTime = 0; + mouse = true; + plugins = with pkgs; [ + { + plugin = tmuxPlugins.mode-indicator; + } + ]; + extraConfig = /* sh */ '' + # General Settings + set -g set-clipboard on + #Appearance + set -g status-position top + set -g status-style "fg=#${colors.base05} bg=#${colors.base00}" + #Windows + set -g status-justify "centre" + setw -g window-status-current-format "#[bg=#${colors.base0B},fg=#${colors.base00},bold] #W " + setw -g window-status-format "#[bg=#${colors.base03},fg=#${colors.base05}] #W " + #Left + set -g status-left " #{tmux_mode_indicator} #[bg=#${colors.base0B},fg=#${colors.base00}] #S" + set -g status-right '%Y-%m-%d %H:%M #{tmux_mode_indicator}' + #Move to Pane + bind -n M-Left select-pane -L + bind -n M-h select-pane -L + bind -n M-Right select-pane -R + bind -n M-l select-pane -R + bind -n M-Up select-pane -U + bind -n M-k select-pane -U + bind -n M-Down select-pane -D + bind -n M-j select-pane -D + #Split Pane + bind -n M-- split-window -h + bind -n M-= split-window -v + #Resize Pane + bind -n C-M-Up resize-pane -U 5 + bind -n C-M-Down resize-pane -D 5 + bind -n C-M-Left resize-pane -L 5 + bind -n C-M-Right resize-pane -R 5 + #Move to Window + bind -n M-1 + ''; + }; + }; +} diff --git a/home/modules/console/shell/fish/default.nix b/home/modules/console/shell/fish/default.nix index c65881b..68bcab7 100644 --- a/home/modules/console/shell/fish/default.nix +++ b/home/modules/console/shell/fish/default.nix @@ -7,7 +7,6 @@ let hasNeovim = config.programs.neovim.enable; hasBat = hasPackage "bat"; hasHelix = hasPackage "helix"; - hasKitty = config.programs.kitty.enable; in { config = { @@ -47,26 +46,6 @@ in }; functions = { fish_greeting = ""; - zellij_session_select = '' - if not set -q ZELLIJ - set -l ZJ_SESSIONS (zellij list-sessions | awk '{print $1}') - set -l NO_SESSIONS (count $ZJ_SESSIONS) - - if test $NO_SESSIONS -gt 0 - set -l SELECTED_SESSION (printf "%s\n" $ZJ_SESSIONS | sk --ansi) - - if test -n "$SELECTED_SESSION" - zellij attach -c $SELECTED_SESSION - else - zellij - end - else - zellij - end - end - - ''; - fish_flake_edit = '' cd $FLAKE hx $FLAKE @@ -81,10 +60,6 @@ in ''; }; interactiveShellInit = - # zellij auto start script - '' - zellij_session_select - '' + '' set --global KITTY_INSTALLATION_DIR "${pkgs.kitty}/lib/kitty" set --global KITTY_SHELL_INTEGRATION enabled diff --git a/home/profile/base/default.nix b/home/profile/base/default.nix index b31db77..a7c3d6d 100644 --- a/home/profile/base/default.nix +++ b/home/profile/base/default.nix @@ -55,7 +55,7 @@ in fish.enable = true; bash.enable = true; }; - multiplexer.zellij.enable = true; + multiplexer.tmux.enable = true; utility = { nixIndex.enable = true; git.enable = true;