From 48c024c7ede2f032dbf1529802328b3b639623bc Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sat, 26 Aug 2023 16:58:06 +0200 Subject: [PATCH] pinwheel: Extract `tmux` module --- hosts/pinwheel/configuration.nix | 1 + hosts/pinwheel/home.nix | 62 ------------------------ hosts/pinwheel/modules/tmux/default.nix | 64 +++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 62 deletions(-) create mode 100644 hosts/pinwheel/modules/tmux/default.nix diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index 4798b99..888ea58 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -14,6 +14,7 @@ ./modules/ssh ./modules/git ./modules/zsh + ./modules/tmux ./modules/vim ./modules/foot ./modules/syncthing diff --git a/hosts/pinwheel/home.nix b/hosts/pinwheel/home.nix index 389fcf7..c4fd0a0 100644 --- a/hosts/pinwheel/home.nix +++ b/hosts/pinwheel/home.nix @@ -12,68 +12,6 @@ bemenu ]; - programs.tmux = { - enable = true; - - baseIndex = 1; - keyMode = "vi"; - - # Allow vi mode to be enabled instantly - escapeTime = 0; - - plugins = [ - pkgs.tmuxPlugins.sensible - ]; - - extraConfig = '' - set -g renumber-windows on - - # https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/ - set -g default-terminal "xterm-256color" - set -ga terminal-overrides ",*256col*:Tc" - set -ga terminal-overrides "*:Ss=\E[%p1%d q:Se=\E[ q" - set-environment -g COLORTERM "truecolor" - - set-option -g allow-rename off - - # Status line colors - set -g status-fg '#f9c22b' - set -g status-bg '#303030' - - # Remove date/time etc. on the right side - set -g status-right "" - - # Status window colors - set -g window-status-current-style bg='#3a3a3a',fg='#f9c22b' - set -g window-status-current-style bg='#3a3a3a',fg='#f9c22b' - set -g window-status-style bg='#303030',fg='#767676' - - set -g pane-border-style fg='#3a3a3a' - set -g pane-active-border-style fg='#f9c22b' - - bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded" - - bind | split-window -h -c "#{pane_current_path}" - bind - split-window -v -c "#{pane_current_path}" - - # Move panes shortcuts - bind h select-pane -L - bind j select-pane -D - bind k select-pane -U - bind l select-pane -R - - # Resize panes - bind -r H resize-pane -L 10 - bind -r J resize-pane -D 10 - bind -r K resize-pane -U 10 - bind -r L resize-pane -R 10 - - # Move windows - bind -r Left swap-window -t -1 \; select-window -t -1 - bind -r Right swap-window -t +1 \; select-window -t +1 - ''; - }; - wayland.windowManager.hyprland = { enable = true; diff --git a/hosts/pinwheel/modules/tmux/default.nix b/hosts/pinwheel/modules/tmux/default.nix new file mode 100644 index 0000000..54a61e9 --- /dev/null +++ b/hosts/pinwheel/modules/tmux/default.nix @@ -0,0 +1,64 @@ +{ home-manger, pkgs, ... }: +{ + home-manager.users.alex = { + programs.tmux = { + enable = true; + + baseIndex = 1; + keyMode = "vi"; + + # Allow vi mode to be enabled instantly + escapeTime = 0; + + plugins = [ pkgs.tmuxPlugins.sensible ]; + + extraConfig = '' + set -g renumber-windows on + + # https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/ + set -g default-terminal "xterm-256color" + set -ga terminal-overrides ",*256col*:Tc" + set -ga terminal-overrides "*:Ss=\E[%p1%d q:Se=\E[ q" + set-environment -g COLORTERM "truecolor" + + set-option -g allow-rename off + + # Status line colors + set -g status-fg '#f9c22b' + set -g status-bg '#303030' + + # Remove date/time etc. on the right side + set -g status-right "" + + # Status window colors + set -g window-status-current-style bg='#3a3a3a',fg='#f9c22b' + set -g window-status-current-style bg='#3a3a3a',fg='#f9c22b' + set -g window-status-style bg='#303030',fg='#767676' + + set -g pane-border-style fg='#3a3a3a' + set -g pane-active-border-style fg='#f9c22b' + + bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded" + + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + + # Move panes shortcuts + bind h select-pane -L + bind j select-pane -D + bind k select-pane -U + bind l select-pane -R + + # Resize panes + bind -r H resize-pane -L 10 + bind -r J resize-pane -D 10 + bind -r K resize-pane -U 10 + bind -r L resize-pane -R 10 + + # Move windows + bind -r Left swap-window -t -1 \; select-window -t -1 + bind -r Right swap-window -t +1 \; select-window -t +1 + ''; + }; + }; +}