git-hooks.nix icon indicating copy to clipboard operation
git-hooks.nix copied to clipboard

Documentation on how to set up spell checking

Open Dietr1ch opened this issue 1 year ago • 2 comments

It seems that hunspell is not that easy to get working (#159 sort of complains about it)

I can't get hunspell to work either, it simply skips all files, so I'm guessing that it might be good to have an example on how to use hunspell too.

# https://devenv.sh/reference/options/#pre-commit
pre-commit = {
  hooks = {
    # Spelling
    hunspell = {
      enable = true;
    };
  };
};

After some fooling around I ended up with,

env = {
  DICTIONARY = "en_GB";
};

pre-commit = {
  hooks = {
    # Spelling
    hunspell = {
      enable = true;
      description = "Run hunspell on all org files";
      files = "\.org$";
      entry = "${pkgs.hunspell}/bin/hunspell -p .spelling/dictionary -l";
    };
  };
};

That -l flag made me trip, as it's key and without it hunspell runs in interactive mode and results in a busy wait when running pre-commit run --all-files --show-diff-on-failure.

Dietr1ch avatar Oct 21 '24 18:10 Dietr1ch