{
  config,
  pkgs,
  ...
}: {
  programs = {
    # thefuck = {
    #   enable = true;
    #   enableZshIntegration = true;
    # };
    direnv = {
      enable = true;
      enableZshIntegration = true;
      nix-direnv.enable = true;
    };

    zsh = {
      enable = true;
      enableVteIntegration = true;

      enableCompletion = true;
      completionInit = ''
      '';

      autosuggestion = {
        enable = true;
        strategy = [
          "match_prev_cmd"
          "completion"
          "history"
        ];
      };

      autocd = true; # I'll try this out, may be removed later

      antidote = {
        enable = true;
        plugins = [
          "getantidote/use-omz" # Handle OMZ dependencies
          # Load lib only if things break
          # "ohmyzsh/ohmyzsh path:lib"   # Load OMZ's library
          "ohmyzsh/ohmyzsh path:plugins/colored-man-pages" # Load OMZ plugins
          # "ohmyzsh/ohmyzsh path:plugins/magic-enter"
          "ohmyzsh/ohmyzsh path:plugins/command-not-found" # Provide suggested packages to be installed if a command cannot be found
          "ohmyzsh/ohmyzsh path:plugins/dirhistory kind:defer" # shortcuts for navigating directory history and hierarchy

          "romkatv/powerlevel10k kind:fpath" #  A Zsh theme

          "z-shell/F-Sy-H kind:defer" # Feature-rich Syntax Highlighting for Zsh
          "zsh-users/zsh-autosuggestions kind:defer" # Simple plugin installation
          # { name = "zsh-users/zsh-syntax-highlighting"; }
          "zsh-users/zsh-completions kind:fpath path:src" # Adds some missing completions to zsh
          "zsh-users/zsh-history-substring-search kind:defer" # ZSH port of Fish history search (up arrow)

          "jiriks74/git-aliases kind:defer" # Aliases for git
          "MichaelAquilina/zsh-you-should-use" # Did you forget to use an alias?

          # "babarot/enhancd" # Includes simmilar functionality to zsh-z
          "agkozak/zsh-z" # Jump arount your filesystem with ease
          "supercrabtree/k" # Directory listings for Zsh with git features.

          "belak/zsh-utils path:completion" # Load and initialize the built-in zsh completion system
          "belak/zsh-utils path:editor" # Override and fill in the gaps of the default keybinds
          "belak/zsh-utils path:utility kind:defer" # Common shell utilities

          "gko/ssh-connect" # List of most used ssh connections
          "sineto/web-search kind:defer" # zsh plugin for web searching
        ];
      };

      initExtraFirst = ''
        # Basic auto/tab complete:
        autoload -U compinit
        zstyle ':completion:*' menu select
        zmodload zsh/complist
        _comp_options+=(globdots)               # Include hidden files.

        if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
          zmodload zsh/zprof # Profiling. Enable `zprof` at the end of initExtra too.
        fi
      '';

      initExtra = ''
        # From antidote (for p10k):
        # prompts:
        #   with prompt plugins, remember to add this to your .zshrc:
        # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
        [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
        autoload -Uz promptinit && promptinit && prompt powerlevel10k

        # Remove nix from path if we are in a container (distrobox)
        if [ -v DISTROBOX_ENTER_PATH ]; then
          export PATH=$(echo $PATH | tr ':' '\n' | grep -vE '/nix/|/run/wrappers|\.nix-profile|/etc/profiles/per-user/jirka/bin|/run/current-system/sw/bin' | tr '\n' ':')
          export PATH=$(echo $PATH | sed 's/:$//')
        fi

        if [ -v ASCIINEMA_REC ]; then
          _zsh_autosuggest_disable
        fi

        bindkey '^ ' autosuggest-accept # Bind CTRL + Space
        bindkey '^Y' autosuggest-accept # Bind CTRL + Y

        bindkey "$terminfo[kcuu1]" history-substring-search-up
        bindkey "$terminfo[kcud1]" history-substring-search-down
        bindkey -M vicmd 'k' history-substring-search-up
        bindkey -M vicmd 'j' history-substring-search-down

        # Extracting
        ex ()
        {
        if [ -f $1 ] ; then
          case $1 in
            *.tar.bz2)   tar xjf $1   ;;
            *.tar.gz)    tar xzf $1   ;;
            *.tar.xz)    tar xJf $1   ;;
            *.bz2)       bunzip3 $1   ;;
            *.rar)       unrar x $1   ;;
            *.gz)        gunzip $1    ;;
            *.tar)       tar xf $1    ;;
            *.tbz2)      tar xjf $1   ;;
            *.tgz)       tar xzf $1   ;;
            *.zip)       unzip $1     ;;
            *.Z)         uncompress $1;;
            *.7z)        7z x $1      ;;
            *)           echo "'$1' cannot be extracted via ex()" ;;
          esac
        else
          echo "'$1' is not a valid file"
        fi
        }

        # Kitty binds
        if [ "$TERM" = "xterm-kitty" ]; then
          alias kssh="kitty +kitten ssh"
          alias icat="kitty +kitten icat"
          alias d="kitty +kitten diff"
          alias get="kitty +kitten transfer"
          alias put="kitty +kitten transfer --direction=upload"
          alias kclip="kitty +kitten clipboard"
        fi

        if [[ "''${ZSH_PROFILE}" -eq 1 ]]; then
          zprof
        fi
      '';

      localVariables = {
        YSU_MESSAGE_POSITION = "after";
        ASCIINEMA_API_URL = "https://asciinema.stefka.eu";
      };

      shellAliases = {
        # update = "sudo nixos-rebuild switch";

        ls = "lsd";
        # ls, the common ones I use a lot shortened for rapid fire usage
        l = "ls -lFh"; #size,show type,human readable
        la = "ls -lAFh"; #long list,show almost all,show type,human readable
        lr = "ls -tRFh"; #sorted by date,recursive,show type,human readable
        lt = "ls -ltFh"; #long list,sorted by date,show type,human readable
        ll = "ls -l"; #long list
        ldot = "ls -ld .*";
        lS = "ls -1FSsh";
        lart = "ls -1Fcart";
        lrt = "ls -1Fcrt";

        grep = "grep --color";
        sgrep = "grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ";

        t = "tail -f";

        dud = "du -d 1 -h";
        duf = "du -sh *";
        # fd="find . -type d -name";
        ff = "find . -type f -name";

        h = "history";
        hgrep = "fc -El 0 | grep";
        help = "man";
        p = "ps -f";
        sortnr = "sort -n -r";
        unexport = "unset";

        # Use trash instead of rm if available
        rm = "trash";
        cp = "cp -i";
        mv = "mv -i";

        cls = "clear";

        sshc = "ssh-connect";
      };

      shellGlobalAliases = {
        H = "| head";
        T = "| tail";
        G = "| grep";
        L = "| less";
        M = "| most";
        LL = "2>&1 | less";
        CA = "2>&1 | cat -A";
        NE = "2> /dev/null";
        NUL = "> /dev/null 2>&1";
        P = "2>&1| pygmentize -l pytb";
      };

      history = {
        # ignoreAllDups = true;
        path = "${config.xdg.cacheHome}/zhistory";
        save = 10000;
        size = 10000;
        share = false;
      };
    };
  };

  home.packages = with pkgs; [
    nix-zsh-completions

    python312Packages.pygments # For antidote

    # tools for aliases, etc.
    lsd
    bat
    eza
    trash-cli
    # ^ tools for aliases, etc.

    # packages for enhancd
    fzf # enhancd
    fd # enhancd
    # ^ packages for enhancd

    # rofi   # for fd

    # packags for ex
    gnutar
    bzip3
    unzip
    p7zip
    unrar
    gzip
    # ^ packages for ex
  ];
}