tmux.nix 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. { pkgs, ... }:
  2. {
  3. programs.tmux = {
  4. enable = true;
  5. aggressiveResize = true;
  6. baseIndex = 1;
  7. clock24 = true;
  8. customPaneNavigationAndResize = true;
  9. escapeTime = 0;
  10. historyLimit = 10000;
  11. keyMode = "vi";
  12. prefix = "`";
  13. secureSocket = false;
  14. shell = "${pkgs.zsh}/bin/zsh";
  15. terminal = "tmux-256color";
  16. sensibleOnTop = false;
  17. extraConfig = ''
  18. # Reload the config
  19. bind r source-file ~/.config/tmux/tmux.conf \; display "configuration file reloaded"
  20. # Synchronize panes
  21. bind e setw synchronize-panes \; display "synchronize mode"
  22. # Splits
  23. unbind %
  24. unbind '"'
  25. bind b split-window -v
  26. bind v split-window -h
  27. # Panes numbers
  28. set -g display-panes-active-colour colour20
  29. set -g display-panes-colour colour196
  30. # enable vi-mode
  31. setw -g mode-keys vi
  32. set -g status-keys vi
  33. # copy paste
  34. unbind [
  35. bind Escape copy-mode
  36. unbind p
  37. bind p paste-buffer
  38. bind-key -T copy-mode-vi 'v' send -X begin-selection
  39. bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
  40. # command mode
  41. bind : command-prompt
  42. # Kill panes
  43. bind x kill-pane
  44. # Toggle Status
  45. bind t set status
  46. # Lock the tty
  47. bind z run-shell "physlock -dmp 'you cant run this system fuckin looser'"
  48. # Alerts
  49. setw -g monitor-activity on
  50. set -g visual-activity on
  51. # Enable mouse mode
  52. setw -g mouse on
  53. setw -qg mode-mouse on
  54. set -qg mouse-select-pane on
  55. set -qg mouse-resize-pane on
  56. set -qg mouse-select-window on
  57. set -qg mouse-utf8 on
  58. set -qg mouse on
  59. # Default terminal mode
  60. set -g default-terminal 'tmux-256color'
  61. set -sa terminal-overrides ',xterm-256color:RGB'
  62. # Status and colors
  63. set -g status on
  64. set -g status-justify left
  65. set -g status-interval 2
  66. set -qg status-utf on
  67. set -g status-style fg=colour130,bg=colour235
  68. setw -g automatic-rename on
  69. setw -g window-status-style bg=default,fg=colour33
  70. setw -g window-status-current-style bg=default,fg=colour196
  71. # HJKL / vi-like pane traversal
  72. bind h select-pane -L
  73. bind j select-pane -D
  74. bind k select-pane -U
  75. bind l select-pane -R
  76. # Resize panes
  77. bind -r H resize-pane -L 5
  78. bind -r J resize-pane -D 5
  79. bind -r K resize-pane -U 5
  80. bind -r L resize-pane -R 5
  81. # Right status
  82. set -g status-right-length 150
  83. set -g status-right '#(~/.local/bin/tmux-status)'
  84. set -g status-left-length 75
  85. set -g status-left ""
  86. # Visuals
  87. setw -g monitor-activity off
  88. set-option -g bell-action none
  89. set-option -g visual-activity on
  90. set-option -g visual-bell off
  91. set-option -g visual-silence off
  92. # clock
  93. set -g clock-mode-colour colour20
  94. # urlview
  95. run-shell $HOME/.local/bin/tmux.urlview
  96. # No delay
  97. set -sg escape-time 0
  98. # History
  99. set -g history-limit 10000
  100. # Scrolling
  101. set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
  102. # Panes index
  103. set -g pane-base-index 1
  104. set -g renumber-windows on
  105. # Pane numbers
  106. set -g display-panes-active-colour colour20
  107. set -g display-panes-colour colour196
  108. # Pane borders
  109. # set-option -g pane-border-fg colour235
  110. # set-option -g pane-active-border-fg colour46
  111. set -g pane-border-style fg=green,bg=black
  112. set -g pane-active-border-style fg=white,bg=yellow
  113. # Windows index
  114. set -g base-index 1
  115. # Layouts
  116. bind Z previous-layout
  117. bind X next-layout
  118. # Detach others
  119. bind D detach -a
  120. # Update environments
  121. set -g update-environment "DBUS_SESSION_BUS_ADDRESS WAYLAND_DISPLAY DISPLAY SSH_AUTH_SOCK XAUTHORITY"
  122. # Message text
  123. set -g message-style bg=colour235,fg=colour196
  124. '';
  125. };
  126. }