ark/users/modules/zsh/default.nix

57 lines
1.4 KiB
Nix
Raw Normal View History

2022-08-11 05:44:58 +03:00
{
config,
tlib,
lib,
pkgs,
...
}: let
pkgBin = tlib.pkgBin;
in {
programs.zsh = {
enable = true;
autocd = true;
enableVteIntegration = true;
enableAutosuggestions = true;
enableCompletion = true;
plugins = [
{
name = "per-directory-history";
src = pkgs.fetchFromGitHub {
owner = "jimhester";
repo = "per-directory-history";
rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06";
hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q=";
};
}
];
# xdg compliant
dotDir = ".config/zsh";
history.path = "${config.home.homeDirectory}/.local/share/zsh/history";
initExtra = ''
${
lib.optionalString
(config.programs.ssh.enable && config.services.gpg-agent.enable)
"export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)"
}
function tomp4 () {
${pkgBin pkgs.ffmpeg} -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4"
}
function topng () {
${pkgBin pkgs.ffmpeg} -i $1 "$1.png"
}
# fix some key stuff
bindkey "$terminfo[kRIT5]" forward-word
bindkey "$terminfo[kLFT5]" backward-word
# makes completions pog
zstyle ':completion:*' menu select
# which env we are in
${pkgBin pkgs.any-nix-shell} zsh --info-right | source /dev/stdin
'';
};
}