From 5951004562f0445cef82079caa4506374dbb1e46 Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Thu, 12 Dec 2024 11:52:54 -0800 Subject: [PATCH] Fix tmux configuration --- nix/home/programs/tmux/default.nix | 15 ++++++---- nix/home/programs/tmux/tmux.conf | 32 ++++----------------- nix/system/worktop/darwin-configuration.nix | 1 + 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/nix/home/programs/tmux/default.nix b/nix/home/programs/tmux/default.nix index 63a195d..fad9843 100644 --- a/nix/home/programs/tmux/default.nix +++ b/nix/home/programs/tmux/default.nix @@ -1,14 +1,19 @@ -{ pkgs, ... }: +{ ... }: { programs.tmux = { enable = true; tmuxinator = { enable = true; }; - secureSocket = false; - }; - home.file.".tmux.conf" = { - source = ./tmux.conf; + terminal = "screen-256color"; + aggressiveResize = true; + secureSocket = false; + baseIndex = 1; + historyLimit = 10000; + escapeTime = 500; + mouse = true; + + extraConfig = builtins.readFile ./tmux.conf; }; } diff --git a/nix/home/programs/tmux/tmux.conf b/nix/home/programs/tmux/tmux.conf index 1da5299..a249a5e 100644 --- a/nix/home/programs/tmux/tmux.conf +++ b/nix/home/programs/tmux/tmux.conf @@ -1,20 +1,3 @@ -# reload tmux conf -unbind r -bind r source-file ~/.tmux.conf - -bind-key C-a last-window - -setw -g aggressive-resize on - -# faster escape recognition -set-option -sg escape-time 50 - -# number tabs starting at 1 -set-option -g base-index 1 - -set-option -g default-terminal screen-256color - -# STATUS BAR set-option -g status-bg colour234 # light gray bg set-option -g status-fg colour255 # black text @@ -24,17 +7,12 @@ setw -g window-status-current-format "#[fg=white,bold]#[bg=cyan][#I:#W]" set-option -g set-titles on set-option -g set-titles-string '[#S:#I #H] #W' -# mouse mode -set -g mouse on - # clipboard set -g set-clipboard off -# big scrollback -set-option -g history-limit 10240 +bind-key C-a last-window + +# https://github.com/tmux/tmux/issues/4240 and https://github.com/LnL7/nix-darwin/issues/1181 +set -gu default-command +set-option -g default-shell "$SHELL" -# smart pane switching with awareness of vim splits -bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" -bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" -bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" -bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" diff --git a/nix/system/worktop/darwin-configuration.nix b/nix/system/worktop/darwin-configuration.nix index 2dc11c8..4de61c8 100644 --- a/nix/system/worktop/darwin-configuration.nix +++ b/nix/system/worktop/darwin-configuration.nix @@ -74,6 +74,7 @@ in pkgs.syncthing pkgs.slack pkgs._1password + # pkgs._1password-gui pkgs.tailscale whatsapp obs-studio