<commit_before>{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.programs.vim;
  defaultPlugins = [ "sensible" ];

  knownSettings = {
    background = types.enum [ "dark" "light" ];
    expandtab = types.bool;
    history = types.int;
    number = types.bool;
    relativenumber = types.bool;
    shiftwidth = types.int;
    tabstop = types.int;
  };

  vimSettingsType = types.submodule {
    options =
      let
        opt = name: type: mkOption {
          type = types.nullOr type;
          default = null;
          visible = false;
        };
      in
        mapAttrs opt knownSettings;
  };

  setExpr = name: value:
    let
      v =
        if isBool value then (if value then "" else "no") + name
        else name + "=" + toString value;
    in
      optionalString (value != null) ("set " + v);

in

{
  options = {<commit_msg>vim: add more vim settings<commit_after>{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.programs.vim;
  defaultPlugins = [ "sensible" ];

  knownSettings = {
    background = types.enum [ "dark" "light" ];
    copyindent = types.bool;
    expandtab = types.bool;
    hidden = types.bool;
    history = types.int;
    ignorecase = types.bool;
    modeline = types.bool;
    number = types.bool;
    relativenumber = types.bool;
    shiftwidth = types.int;
    smartcase = types.bool;
    tabstop = types.int;
  };

  vimSettingsType = types.submodule {
    options =
      let
        opt = name: type: mkOption {
          type = types.nullOr type;
          default = null;
          visible = false;
        };
      in
        mapAttrs opt knownSettings;
  };

  setExpr = name: value:
    let
      v =
        if isBool value then (if value then "" else "no") + name
        else name + "=" + toString value;
    in
      optionalString (value != null) ("set " + v);

in

{
  options = {
{'fraction_non_alphanumeric': 0.1206246634356489, 'fraction_numerical': 0.0, 'mean_word_length': 2.011345218800648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4299112', 'n_tokens_mistral': 608, 'n_tokens_neox': 592, 'n_words': 162}