nixos-config/modules/programs/zsh/default.nix

98 lines
2.7 KiB
Nix
Raw Normal View History

2021-08-04 17:07:42 +00:00
{ config, pkgs, ... }:
2021-07-29 20:21:51 +00:00
{
environment = {
systemPackages = [ pkgs.zsh ];
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh" ];
};
# Otherwise the user won't appear on the GDM login screen
programs.zsh.enable = true;
2021-08-04 17:07:42 +00:00
home-manager.users."${config.system.singleUser}".programs.zsh = {
2021-07-29 20:21:51 +00:00
enable = true;
history.ignoreSpace = true;
shellAliases = {
ls = "ls --color=always";
".." = "cd ..";
"..." = "cd ../../";
dev = "cd $HOME/Development";
home = "cd $HOME";
reload = "$SHELL -l";
gs = "git status";
gd = "git diff";
gds = "git diff --staged";
c = "clear";
suspend = "systemctl suspend";
waifu2x = "flatpak run com.github.nihui.waifu2x-ncnn-vulkan";
2021-07-29 20:21:51 +00:00
};
initExtra = ''
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "\e[3~" delete-char
'';
history.share = true;
2021-08-30 09:20:31 +00:00
# TODO: Maybe move this somewhere else
initExtraFirst = ''
wcurl() {
[[ -z "$1" ]] && echo "Error: No URL specified" && exit 1
local filename="$(basename $1)"
curl -fLo "$filename" "$1"
}
'';
2021-07-29 20:21:51 +00:00
plugins = [
{
name = "pure.zsh";
file = "pure.zsh";
src = pkgs.fetchFromGitHub {
owner = "sindresorhus";
repo = "pure";
rev = "v1.17.0";
sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa";
};
}
{
name = "zsh-history-substring-search";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-history-substring-search";
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
};
}
{
name = "completion";
file = "init.zsh";
src = pkgs.fetchFromGitHub {
owner = "zimfw";
repo = "completion";
rev = "db079f405397a9dc9af93883e47d8adff817e3b1";
sha256 = "1vakjj8l10discmzrzjq6nd0bg0jf4chxhwpiq7ldkirzy7lmm9c";
};
}
2021-07-29 20:21:51 +00:00
{
name = "zsh-completions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "d4511c23659381b56dec8be8c8553b7ff3dc5fd8";
sha256 = "1y8wkmhgkkyfz91y1f8crh6cg912n87gmcchc8xhnwji11n1mqrq";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "6e0e950154a4c6983d9e077ed052298ad9126144";
sha256 = "09bkg1a7qs6kvnq17jnw5cbcjhz9sk259mv0d5mklqaifd0hms4v";
};
}
2021-07-29 20:21:51 +00:00
];
};
}