From 83232cc22aacd60ecb65d34da7186d647e303555 Mon Sep 17 00:00:00 2001 From: Jack Mechem Date: Mon, 28 Jul 2025 11:19:08 -0700 Subject: [PATCH] tmux, organize --- hosts/t480/home.nix | 1 + modules/home-manager/tmux.nix | 74 +++++++++++++++++++++++++++++++++++ modules/home-manager/zsh.nix | 3 +- modules/nixos/user-jack.nix | 2 +- 4 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 modules/home-manager/tmux.nix diff --git a/hosts/t480/home.nix b/hosts/t480/home.nix index e07d980..b73dfd1 100644 --- a/hosts/t480/home.nix +++ b/hosts/t480/home.nix @@ -5,6 +5,7 @@ imports = [ inputs.zen-browser.homeModules.twilight ../../modules/home-manager/zsh.nix + ../../modules/home-manager/tmux.nix ]; programs.home-manager.enable = true; diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix new file mode 100644 index 0000000..004e639 --- /dev/null +++ b/modules/home-manager/tmux.nix @@ -0,0 +1,74 @@ +{ pkgs, ... }: { + programs.tmux = { + enable = true; + baseIndex = 1; + prefix = "C-Space"; + plugins = with pkgs; [ + tmuxPlugins.vim-tmux-navigator + tmuxPlugins.resurrect + tmuxPlugins.continuum + ]; + shell = "${pkgs.zsh}/bin/zsh"; + extraConfig = '' + unbind r + bind r source-file ~/.tmux.conf + + unbind-key C-b + set -g prefix C-Space + + unbind % + bind '=' split-window -h + + unbind '"' + bind - split-window -v + + set -s escape-time 0 + + + # Act like vim + setw -g mode-keys vi + + set-window-option -g mode-keys vi + + bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v" + bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y" + + unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode after dragging with mouse + + bind-key -r j resize-pane -D 5 + bind-key -r k resize-pane -U 5 + bind-key -r l resize-pane -R 5 + bind-key -r h resize-pane -L 5 + + bind -r m resize-pane -Z + + set -g mouse on + + bind S command-prompt -p "New Session:" "new-session -A -s '%%'" + bind K confirm kill-session + + #List of plugins + #set -g @plugin 'tmux-plugins/tpm' + #set -g @plugin 'christoomey/vim-tmux-navigator' + ## set -g @plugin 'jimeh/tmux-themepack' + #set -g @plugin 'tmux-plugins/tmux-resurrect' + #set -g @plugin 'tmux-plugins/tmux-continuum' + ## set -g @plugin 'dracula/tmux' + + # Powerline (I prefer default tmux powerline) + # set -g @themepack 'powerline/default/cyan' + set -g @resurrect-capture-pane-contents 'on' # allow tmux-ressurect to capture pane contents + set -g @continuum-restore 'on' # enable tmux-continuum functionality + + set -g default-terminal "screen-256color" + + set -g status-position bottom + set -g status-left-length 50 + set -g status-right-length 140 + set -g status-justify centre # center align window list + set -g status-bg "colour8" + set -g status-fg "colour7" + ''; + }; +} + diff --git a/modules/home-manager/zsh.nix b/modules/home-manager/zsh.nix index 5265f95..aef17f1 100644 --- a/modules/home-manager/zsh.nix +++ b/modules/home-manager/zsh.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, ... }: let shellAliases = { rebuild-nix = "sudo nixos-rebuild switch --flake /home/jack/nixos/#t480"; @@ -26,4 +26,3 @@ in inherit shellAliases; }; } - diff --git a/modules/nixos/user-jack.nix b/modules/nixos/user-jack.nix index 1ab547b..62eb3af 100644 --- a/modules/nixos/user-jack.nix +++ b/modules/nixos/user-jack.nix @@ -5,7 +5,7 @@ users.users.jack = { isNormalUser = true; shell = pkgs.zsh; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + extraGroups = [ "wheel" "networkmanager" ]; # Enable ‘sudo’ for the user. packages = with pkgs; [ zed-editor cargo ]; }; }