nix-config/modules/basic-tools/multiplexers.nix

68 lines
1.5 KiB
Nix

{ pkgs, inputs, ... }:
{
programs.tmux = {
enable = true;
keyMode = "vi";
escapeTime = 0;
historyLimit = 500000;
aggressiveResize = true;
terminal = "tmux-256color";
extraConfig = ''
# all the colors we can get
set-option -g default-terminal "tmux-256color"
# emacs keys in status
set -g status-keys emacs
# set focus events
set-option -g focus-events on
set -g mouse off
# curlies
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
set -ag terminal-overrides ",$TERM:RGB"
# title
set -g set-titles on
set -g set-titles-string "#T"
# copy to clipboard support
run-shell ${inputs.self.inputs.tmux-yank}/yank.tmux
'';
};
programs.zsh.interactiveShellInit = ''
# create new tmux session with $1 as a name
# if no arguments supplied, use name of current dir
function tn {
if [ $# -eq 0 ]
then
tmux new-session -s $(basename $(pwd))
else
tmux new-session -s $1
fi
}
'';
environment.shellAliases = {
tl = "tmux list-sessions";
ta = "tmux attach -t";
};
environment.systemPackages = [
pkgs.screen
];
programs.screen.screenrc = ''
defscrollback 10000
startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%w"
'';
}