tmux.nix 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. { pkgs
  2. , config
  3. , inputs
  4. , lib
  5. , ...
  6. }:
  7. let
  8. isDarwin = pkgs.stdenv.isDarwin;
  9. reattach-to-user-namespace = lib.getExe' pkgs.reattach-to-user-namespace "reattach-to-user-namespace";
  10. lazygit = lib.getExe pkgs.lazygit;
  11. shell = lib.getExe config.programs.fish.package;
  12. in
  13. {
  14. home.packages = with pkgs; [ eza ];
  15. programs.tmux = {
  16. sensibleOnTop = true;
  17. baseIndex = 1;
  18. clock24 = true;
  19. enable = true;
  20. escapeTime = 10;
  21. keyMode = "vi";
  22. mouse = true;
  23. prefix = "C-Space";
  24. shell = "${lib.getExe config.programs.fish.package}";
  25. terminal = "tmux-256color";
  26. plugins = with pkgs.tmuxPlugins; [
  27. tmux-select-pane-no-wrap
  28. vim-tmux-navigator
  29. yank
  30. {
  31. plugin = inputs.sessionx.packages.${pkgs.system}.default;
  32. extraConfig = ''
  33. set -g @sessionx-x-path '/Users/thomas/workspace/control/home'
  34. set -g @sessionx-custom-paths '/Users/thomas/workspace'
  35. set -g @sessionx-custom-paths-subdirectories true
  36. set -g @sessionx-custom-paths-subdirectories-depth 2
  37. set -g @sessionx-name-template '{-2}/{-1}'
  38. set -g @sessionx-startup-command '${builtins.concatStringsSep " && " [
  39. "tmux new-window -n ai -t {session}"
  40. "tmux rename-window -t {session}:1 editor"
  41. "tmux send-keys -t {session}:editor \"nvim\" Enter"
  42. "tmux send-keys -t {session}:ai \"nix shell nixpkgs#gemini-cli\" Enter"
  43. "tmux send-keys -t {session}:ai \"gemini\" Enter"
  44. "tmux select-window -t {session}:editor"
  45. ]}'
  46. set -g @sessionx-fzf-builtin-tmux 'off'
  47. '';
  48. }
  49. {
  50. plugin = kanagawa;
  51. extraConfig = ''
  52. set -g status-position top
  53. set -g @kanagawa-theme 'dragon'
  54. set -g @kanagawa-refresh-rate 60
  55. set -g @kanagawa-show-left-icon window
  56. set -g @kanagawa-show-battery true
  57. set -g @kanagawa-show-powerline true
  58. # set -g @kanagawa-show-left-sep 
  59. # set -g @kanagawa-show-right-sep 
  60. # set -g @kanagawa-show-left-sep 
  61. # set -g @kanagawa-show-right-sep 
  62. # set -g @kanagawa-show-left-sep 
  63. # set -g @kanagawa-show-right-sep 
  64. # set -g @kanagawa-show-left-sep 
  65. # set -g @kanagawa-show-right-sep 
  66. set -g @kanagawa-show-left-sep 
  67. set -g @kanagawa-show-right-sep 
  68. set -g @kanagawa-show-location false
  69. set -g @kanagawa-ignore-window-colors true
  70. '';
  71. }
  72. ];
  73. extraConfig = ''
  74. ${lib.optionalString isDarwin ''
  75. # sensible plugin assumes $SHELL is /bin/sh
  76. # --- Darwin-Specific Settings (Raw Tmux Commands) ---
  77. # This block is only included if the system is Darwin
  78. set-option -g default-command "${reattach-to-user-namespace} -l $SHELL"
  79. ''}
  80. # split windows on the current path
  81. unbind %
  82. unbind '"'
  83. bind-key % split-window -h -c '#{pane_current_path}'
  84. bind-key '"' split-window -v -c '#{pane_current_path}'
  85. # resize pane with vim motion keys
  86. bind-key -r h resize-pane -L 1
  87. bind-key -r l resize-pane -R 1
  88. bind-key -r j resize-pane -D 1
  89. bind-key -r k resize-pane -U 1
  90. # move between tmux windows
  91. bind-key -n C-e select-window -t :1
  92. bind-key -n C-a select-window -t :2
  93. # some display popups
  94. bind-key -n C-g display-popup -d "#{pane_current_path}" -w 80% -h 80% -E "${lazygit}"
  95. bind-key -n C-t display-popup -d "#{pane_current_path}" -w 75% -h 75% -E "${shell}"
  96. '';
  97. };
  98. }