blob: 53aeb1dbaf803f8b2bd22009a97582076d53e3b5 [file] [log] [blame]
Skyler Turner62330c12022-03-04 22:10:16 +00001{ config, pkgs, nixpkgs }: {
2 programs.zsh = {
3 enable = true;
4 oh-my-zsh = {
5 enable = true;
6 plugins = [ "git" ];
7 theme = "crunch";
8 };
9 history = {
10 size = 10000;
11 path = "${config.xdg.dataHome}/zsh/history";
12 expireDuplicatesFirst = true;
13 extended = true;
14 };
15 initExtra = ''
16 bindkey "\'\'$\{key[Up]}" up-line-or-search
17
18 command_not_found_handler ()
19 {
20 # echo "Command '$1' not found, searching for it in the Nix store..."
21 # , $@
22 local p='/nix/store/ycclzpk99snlrk8sg9n4j8pm1927gavw-command-not-found/bin/command-not-found';
23 if [ -x "$p" ] && [ -f '/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite' ]; then
24 "$p" "$@" 2>&1 | sed -r 's/nix-shell -p (\S+)/nix shell nixpkgs#\1/g' 1>&2;
25 if [ $? = 126 ]; then
26 "$@";
27 else
28 return 127;
29 fi;
30 else
31 echo "$1: command not found" 1>&2;
32 return 127;
33 fi
34 }
35 '';
36 enableSyntaxHighlighting = true;
37 enableAutosuggestions = true;
38 autocd = true;
39 dotDir = ".local/share/zsh";
40 };
41}