summaryrefslogtreecommitdiffstats
path: root/common/commandline/tmux.nix
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2020-12-03 16:45:06 +0100
committerMinijackson <minijackson@riseup.net>2020-12-03 16:45:06 +0100
commit3f0e83cb4816e637d8c916fb77217e1c5824dbe5 (patch)
tree65b48ffe6e82459cde97b8ee61a597402ba2617b /common/commandline/tmux.nix
downloadnixos-config-reborn-3f0e83cb4816e637d8c916fb77217e1c5824dbe5.tar.gz
nixos-config-reborn-3f0e83cb4816e637d8c916fb77217e1c5824dbe5.zip
initial commit: most of previous configuration reworked
Diffstat (limited to 'common/commandline/tmux.nix')
-rw-r--r--common/commandline/tmux.nix79
1 files changed, 79 insertions, 0 deletions
diff --git a/common/commandline/tmux.nix b/common/commandline/tmux.nix
new file mode 100644
index 0000000..aa4de9c
--- /dev/null
+++ b/common/commandline/tmux.nix
@@ -0,0 +1,79 @@
1{ config, pkgs, ... } :
2
3let
4 # Thanks: https://github.com/DanielFGray/dotfiles/blob/master/tmux.remote.conf
5 remoteConf = builtins.toFile "tmux.remote.conf" ''
6 unbind C-q
7 unbind q
8 set-option -g prefix C-s
9 bind s send-prefix
10 bind C-s last-window
11 set-option -g status-position top
12 '';
13in {
14 programs.tmux = {
15 enable = true;
16 shortcut = "q";
17 escapeTime = 10;
18 keyMode = "vi";
19 terminal = "tmux-256color";
20 historyLimit = 50000;
21
22 extraConfig = with config.theme; with pkgs.tmuxPlugins;
23 ''
24 # Plugins
25 run-shell '${copycat}/share/tmux-plugins/copycat/copycat.tmux'
26 run-shell '${sensible}/share/tmux-plugins/sensible/sensible.tmux'
27 run-shell '${urlview}/share/tmux-plugins/urlview/urlview.tmux'
28
29 bind-key R run-shell ' \
30 tmux source-file /etc/tmux.conf > /dev/null; \
31 tmux display-message "sourced /etc/tmux.conf"'
32
33 if -F "$SSH_CONNECTION" "source-file '${remoteConf}'"
34
35 set-option -g status-right ' #{prefix_highlight} "#{=21:pane_title}" %H:%M %d-%b-%y'
36 set-option -g status-left-length 20
37 set-option -g @prefix_highlight_fg '${colors.background}'
38 set-option -g @prefix_highlight_bg '${colors.dominant}'
39 run-shell '${prefix-highlight}/share/tmux-plugins/prefix-highlight/prefix_highlight.tmux'
40
41 # Be faster switching windows
42 bind C-n next-window
43 bind C-p previous-window
44
45 set-option -g set-titles on
46
47 bind C-y run-shell ' \
48 ${pkgs.tmux}/bin/tmux show-buffer > /dev/null 2>&1 \
49 && ${pkgs.tmux}/bin/tmux show-buffer | ${pkgs.xsel}/bin/xsel -ib'
50
51 # Force true colors
52 set-option -ga terminal-overrides ",*:Tc"
53
54 set-option -g mouse on
55 set-option -g focus-events on
56
57 # Stay in same directory when split
58 bind % split-window -h -c "#{pane_current_path}"
59 bind '"' split-window -v -c "#{pane_current_path}"
60
61 # Colorscheme
62 set-option -g status-style 'fg=${colors.dimForeground}, bg=${colors.background}'
63
64 set-option -g window-status-current-style 'fg=${colors.dominant}'
65
66 set-option -g pane-border-style 'fg=${colors.background}'
67 set-option -g pane-active-border-style 'fg=${colors.dominant}'
68
69 set-option -g message-style 'fg=${colors.background}, bg=${colors.dimForeground}'
70
71 set-option -g mode-style 'fg=${colors.background}, bg=${colors.dominant}'
72
73 set-option -g display-panes-active-colour '${colors.dominant}'
74 set-option -g display-panes-colour '${colors.dimForeground}'
75
76 set-option -g clock-mode-colour '${colors.dominant}'
77 '';
78 };
79}