blob: 36c4cc542f787524130b335a5511ebda9c5646e1 [file] [log] [blame]
Skyler Greya2dca222022-09-02 00:02:49 +01001{
2 pkgs,
3 home,
4 username,
Skyler Grey934f1422022-09-04 11:50:04 +01005 fzf-tab,
Skyler Greya2dca222022-09-02 00:02:49 +01006 ...
7}: {
8 home = {
9 programs.zsh = {
10 enable = true;
Skyler Grey934f1422022-09-04 11:50:04 +010011 plugins = [
12 {
13 name = "fzf-tab";
14 src = fzf-tab;
15 }
16 ];
Skyler Greya2dca222022-09-02 00:02:49 +010017 oh-my-zsh = {
18 enable = true;
19 plugins = ["git"];
20 theme = "crunch";
21 };
22 history = {
23 size = 10000;
24 path = "${home.xdg.dataHome}/zsh/history";
25 expireDuplicatesFirst = true;
26 extended = true;
27 };
28 initExtra = ''
29 bindkey -v
30 bindkey "\'\'$\{key[Up]}" up-line-or-search
31
Skyler Greya2dca222022-09-02 00:02:49 +010032 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=243';
33 ZSH_HIGHLIGHT_STYLES[comment]='fg=248';
34
35
36 if [[ $SHLVL != "1" ]]; then
37 export RPS1=$'%{\033[38;5;248m%}(%{$fg[red]%}L$SHLVL%{\033[38;5;248m%})%{\033[39m\033[49m%} '
38 fi
39
40 function tempd {
41 cd "$(mktemp -d)"
42 }
43
44 # disable sort when completing `git checkout`
45 zstyle ':completion:*:git-checkout:*' sort false
46 # set descriptions format to enable group support
47 zstyle ':completion:*:descriptions' format '[%d]'
48 # set list-colors to enable filename colorizing
49 zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
50 # preview directory's content with exa when completing cd
51 zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 -l --color=always $realpath'
52 # switch group using `,` and `.`
53 zstyle ':fzf-tab:*' switch-group ',' '.'
Skyler Grey934f1422022-09-04 11:50:04 +010054 enable-fzf-tab
Skyler Greya2dca222022-09-02 00:02:49 +010055
56 alias compinit="true"
Skyler Grey65e23692022-09-09 23:14:03 +010057
58 source "${./zsh/completions/bun.zsh}"
Skyler Greya2dca222022-09-02 00:02:49 +010059 '';
60 enableSyntaxHighlighting = true;
61 enableAutosuggestions = true;
62 autocd = true;
63 dotDir = ".config/zsh";
64 };
65
Skyler Grey934f1422022-09-04 11:50:04 +010066 home = {
67 shellAliases = {
68 ":q" = "exit";
69 };
70 packages = [pkgs.fzf];
Skyler Greya2dca222022-09-02 00:02:49 +010071 };
72 };
73 config.environment.persistence."/nix/persist".users.${username}.directories = [".local/share/zsh"];
74}