nixvim-config/plugins/blink-cmp-dictionary.nix
Ellis Rahhal e254433f2c * Refactored into separate files
* Baseline functionality
2025-02-14 00:42:22 -08:00

33 lines
803 B
Nix

{ pkgs, lib, ... }:
let
## Remove flags from words
processHunspellDict = filename:
let
content = builtins.readFile filename;
# Remove first line, which is a word count, then split on newlines
lines = builtins.tail (lib.splitString "\n" content);
# Remove flags at the end of words
result = builtins.concatStringsSep "\n" (map (line:
builtins.head (lib.splitString "/" line)
) lines);
in
result;
in
{
programs.nixvim = {
plugins.blink-cmp-dictionary = {
enable = true;
};
extraPackages = with pkgs; [
wordnet
];
};
environment.etc = {
"dictionaries/english-words.txt" = {
text = processHunspellDict "${pkgs.hunspellDicts.en-us-large}/share/hunspell/en_US.dic";
mode = "0444";
};
};
}