aboutsummaryrefslogtreecommitdiff
path: root/users/tdback/modules/tmux/default.nix
blob: f48238c545d18bb1c397627294ef548d6766d8c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ pkgs, ... }:
{
  programs.tmux = {
    enable = true;
    package = pkgs.unstable.tmux;
    terminal = "tmux-256color";
    escapeTime = 0;
    baseIndex = 0;
    historyLimit = 10000;
    mouse = true;
    clock24 = true;
    secureSocket = true;
    aggressiveResize = true;
    prefix = "C-t";
    extraConfig = ''
      # Prevent detaching from tmux when closing a session.
      set -g detach-on-destroy off

      # Don't prompt for confirmation when killing panes.
      bind x kill-pane

      # Splitting panes.
      unbind v
      unbind h
      unbind %
      unbind '"'
      bind v split-window -h -c "#{pane_current_path}" # split vertically
      bind h split-window -v -c "#{pane_current_path}" # split horizontally

      # Navigating panes.
      bind ^ last-window
      bind C-h select-pane -L
      bind C-j select-pane -D
      bind C-k select-pane -U
      bind C-l select-pane -R

      # Copy mode movements.
      set-window-option -g mode-keys vi
      unbind -T copy-mode-vi Space;
      unbind -T copy-mode-vi Enter;
      bind -T copy-mode-vi v send-keys -X begin-selection
      bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"

      # Customizing status bar.
      set -g status-position bottom
      set -g status-style "bg=#050505 fg=#C5C8C6"
      set -g status-right ""
      setw -g window-status-current-format " #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F"
      setw -g window-status-format " #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F"
    '';
  };
}