nixeovim/modules/vim/opts.nix

36 lines
856 B
Nix
Raw Normal View History

2024-04-26 02:08:23 +03:00
{ config, lib, ... }:
{
options.vim = with lib; with types; {
g = mkOption {
type = attrsOf (oneOf [ str bool number ]);
default = { };
2024-04-26 02:08:23 +03:00
};
opt = mkOption {
type = attrsOf anything;
default = { };
2024-04-26 02:08:23 +03:00
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}"));
};
}