{ config, pkgs, ... }:
let
  # Fuzzy shell history and file search.
  #
  # Use fzf to search your command history (with STRG + r) and do file searches (with STRG + t).
  #
  # Resources:
  # https://martinheinz.dev/blog/110
  # https://fryboyter.de/fuzzy-finder-fuer-die-zsh/
  # https://fryboyter.de/suche-mit-fzf-beschleunigen/
  #
  fzf-config = {
    enable = true;
    # Replace the default command `find` with faster `fd`.
    # Why `fd` is better than `ripgrep` in this case: https://www.reddit.com/r/linux4noobs/comments/egb644/fzf_newcomer_fd_or_ripgrep/
    defaultCommand = "fd --type f";
  };
in
{
  home-manager.users."yoda" = { osConfig, config, pkgs, ... }: {
    programs.fzf = fzf-config;
  };
  home-manager.users."root" = { osConfig, config, pkgs, ... }: {
    programs.fzf = fzf-config;
  };

  users.users."yoda" = {
    packages = with pkgs; [
      fd
    ];
  };
  users.users."root" = {
    packages = with pkgs; [
      fd
    ];
  };
}