nixeovim/modules/vim/opts.nix

36 lines
856 B
Nix

{ config, lib, ... }:
{
options.vim = with lib; with types; {
g = mkOption {
type = attrsOf (oneOf [ str bool number ]);
default = { };
};
opt = mkOption {
type = attrsOf anything;
default = { };
description = ''
A special interface |vim.opt| exists for conveniently interacting with list-
and map-style option from Lua: It allows accessing them as Lua tables and
offers object-oriented method for adding and removing entries.
`:help vim.opt`
'';
};
# TODO: think more about vim.cmd
namedCmd = mkOption {
type = attrsOf str;
default = { };
};
cmd = mkOption {
type = str;
readOnly = true;
};
};
config = {
vim.cmd = lib.concatLines (lib.flip lib.mapAttrsToList config.vim.namedCmd (k: v: "\" ${k}\n${v}"));
};
}