Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 1 | { pkgs |
| 2 | , home |
| 3 | , username |
| 4 | , fzf-tab |
| 5 | , ... |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 6 | }: { |
Skyler Grey | 32e3105 | 2023-04-06 18:04:26 +0000 | [diff] [blame] | 7 | config.programs.zsh.enable = true; |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 8 | home = { |
| 9 | programs.zsh = { |
| 10 | enable = true; |
Skyler Grey | 934f142 | 2022-09-04 11:50:04 +0100 | [diff] [blame] | 11 | plugins = [ |
| 12 | { |
| 13 | name = "fzf-tab"; |
| 14 | src = fzf-tab; |
| 15 | } |
| 16 | ]; |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 17 | oh-my-zsh = { |
| 18 | enable = true; |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 19 | plugins = [ "git" ]; |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 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 = '' |
Skyler Grey | 9f68e08 | 2022-10-31 00:16:15 +0000 | [diff] [blame] | 29 | unset __HM_SESS_VARS_SOURCED |
| 30 | . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" |
| 31 | |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 32 | bindkey -v |
| 33 | bindkey "\'\'$\{key[Up]}" up-line-or-search |
| 34 | |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 35 | ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=243'; |
Skyler Grey | f8f0653 | 2022-11-04 10:58:38 +0000 | [diff] [blame] | 36 | typeset -gA ZSH_HIGHLIGHT_STYLES |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 37 | ZSH_HIGHLIGHT_STYLES[comment]='fg=248'; |
| 38 | |
| 39 | |
| 40 | if [[ $SHLVL != "1" ]]; then |
| 41 | export RPS1=$'%{\033[38;5;248m%}(%{$fg[red]%}L$SHLVL%{\033[38;5;248m%})%{\033[39m\033[49m%} ' |
| 42 | fi |
| 43 | |
| 44 | function tempd { |
| 45 | cd "$(mktemp -d)" |
| 46 | } |
| 47 | |
| 48 | # disable sort when completing `git checkout` |
| 49 | zstyle ':completion:*:git-checkout:*' sort false |
| 50 | # set descriptions format to enable group support |
| 51 | zstyle ':completion:*:descriptions' format '[%d]' |
| 52 | # set list-colors to enable filename colorizing |
| 53 | zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} |
| 54 | # preview directory's content with exa when completing cd |
| 55 | zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 -l --color=always $realpath' |
| 56 | # switch group using `,` and `.` |
| 57 | zstyle ':fzf-tab:*' switch-group ',' '.' |
Skyler Grey | 934f142 | 2022-09-04 11:50:04 +0100 | [diff] [blame] | 58 | enable-fzf-tab |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 59 | |
| 60 | alias compinit="true" |
Skyler Grey | 65e2369 | 2022-09-09 23:14:03 +0100 | [diff] [blame] | 61 | |
Skyler Grey | 9f68e08 | 2022-10-31 00:16:15 +0000 | [diff] [blame] | 62 | ulimit -n 131072 |
| 63 | |
Skyler Grey | 65e2369 | 2022-09-09 23:14:03 +0100 | [diff] [blame] | 64 | source "${./zsh/completions/bun.zsh}" |
Skyler Grey | b3504ab | 2022-10-31 00:09:02 +0000 | [diff] [blame] | 65 | source "${./zsh/completions/charm.zsh}" |
Skyler Grey | f957c5a | 2023-02-19 22:21:02 +0000 | [diff] [blame] | 66 | |
| 67 | setopt HIST_IGNORE_SPACE |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 68 | ''; |
| 69 | enableSyntaxHighlighting = true; |
| 70 | enableAutosuggestions = true; |
| 71 | autocd = true; |
| 72 | dotDir = ".config/zsh"; |
| 73 | }; |
| 74 | |
Skyler Grey | 934f142 | 2022-09-04 11:50:04 +0100 | [diff] [blame] | 75 | home = { |
| 76 | shellAliases = { |
| 77 | ":q" = "exit"; |
Skyler Grey | 04122e8 | 2022-10-30 23:13:01 +0000 | [diff] [blame] | 78 | "q" = "exit"; |
Skyler Grey | 934f142 | 2022-09-04 11:50:04 +0100 | [diff] [blame] | 79 | }; |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 80 | packages = [ pkgs.fzf ]; |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 81 | }; |
| 82 | }; |
Skyler Grey | 252927a | 2022-10-18 22:18:15 +0100 | [diff] [blame] | 83 | config.environment.persistence."/nix/persist".users.${username}.directories = [ ".local/share/zsh" ]; |
Skyler Grey | a2dca22 | 2022-09-02 00:02:49 +0100 | [diff] [blame] | 84 | } |