blob: 72d2bdb62ae2298c522127209d8c2054e6bac631 [file] [log] [blame]
Skyler Turner0ab3b7f2022-03-04 23:24:10 +00001{ config, ... }: {
Skyler Turner62330c12022-03-04 22:10:16 +00002 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 local p='/nix/store/ycclzpk99snlrk8sg9n4j8pm1927gavw-command-not-found/bin/command-not-found';
21 if [ -x "$p" ] && [ -f '/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite' ]; then
22 "$p" "$@" 2>&1 | sed -r 's/nix-shell -p (\S+)/nix shell nixpkgs#\1/g' 1>&2;
23 if [ $? = 126 ]; then
24 "$@";
25 else
26 return 127;
27 fi;
28 else
29 echo "$1: command not found" 1>&2;
30 return 127;
31 fi
32 }
Skyler Greye2f4ab92022-05-20 12:09:15 +010033
34 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=243';
Skyler Grey87c0f2c2022-05-24 13:22:19 +010035 ZSH_HIGHLIGHT_STYLES[comment]='fg=248';
Skyler Greye45bfb82022-07-20 17:13:27 +010036
37 if [[ $SHLVL != "1" ]]; then
38 export prompt="($SHLVL) $prompt"
39 fi
Skyler Turner62330c12022-03-04 22:10:16 +000040 '';
41 enableSyntaxHighlighting = true;
42 enableAutosuggestions = true;
43 autocd = true;
44 dotDir = ".local/share/zsh";
45 };
Skyler Greye2f4ab92022-05-20 12:09:15 +010046}