From 524ecc7cddc5f14f72781eb3dc1698299efb359e Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 2 Apr 2024 17:15:43 +0200 Subject: [PATCH] [packages] added tmux --- nix/home/default.nix | 1 + nix/home/tmux/default.nix | 1 + nix/home/tmux/tmux.nix | 81 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 nix/home/tmux/default.nix create mode 100644 nix/home/tmux/tmux.nix diff --git a/nix/home/default.nix b/nix/home/default.nix index c8622b3..fbd983b 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -11,6 +11,7 @@ ./mpv ./ssh ./theme + ./tmux ./virt-manager ./xdg ./zsh diff --git a/nix/home/tmux/default.nix b/nix/home/tmux/default.nix new file mode 100644 index 0000000..67da4c2 --- /dev/null +++ b/nix/home/tmux/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./tmux.nix ]; } diff --git a/nix/home/tmux/tmux.nix b/nix/home/tmux/tmux.nix new file mode 100644 index 0000000..dcdf100 --- /dev/null +++ b/nix/home/tmux/tmux.nix @@ -0,0 +1,81 @@ +{ config, pkgs, ... }: +{ + + # tmux + programs.tmux = { + enable = true; + + # settings + clock24 = true; + historyLimit = 20000; + keyMode = "vi"; + mouse = true; + + # extra config + extraConfig = '' + # override colors + set-option -sa terminal-overrides ",xterm*:Tc" + + # start windows and panes at 1, not 0 + set -g base-index 1 + set -g pane-base-index 1 + set-window-option -g pane-base-index 1 + set-option -g renumber-windows on + + # use alt-arrow keys without prefix key to switch panes + bind -n M-Left select-pane -L + bind -n M-Right select-pane -R + bind -n M-Up select-pane -U + bind -n M-Down select-pane -D + + # shift arrow to switch windows + bind -n S-Left previous-window + bind -n S-Right next-window + + # keybindings + bind-key -T copy-mode-vi v send-keys -X begin-selection + bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle + bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + # split windows + bind '"' split-window -v -c "#{pane_current_path}" + bind % split-window -h -c "#{pane_current_path}" + ''; + + # configure plugins + plugins = with pkgs; [ { + + # resurrect + plugin = tmuxPlugins.resurrect; + extraConfig = "set -g @resurrect-strategy-nvim 'session'"; + + } { + + # continuum + plugin = tmuxPlugins.continuum; + extraConfig = '' + set -g @continuum-restore 'on' + set -g @continuum-save-interval '60' + ''; + + } { + + # vim-tmux-navigator + plugin = tmuxPlugins.vim-tmux-navigator; + + } { + + # catppuccin theme + plugin = tmuxPlugins.catppuccin; + extraConfig = '' + set -g @catppuccin_flavour 'mocha' + ''; + } { + + # yank + plugin = tmuxPlugins.yank; + + } + ]; + }; +}