modules/autopairs

feat: apply new module format to nvim-autopairs
This commit is contained in:
NotAShelf 2023-02-27 17:53:34 +03:00
commit b917526be7
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
8 changed files with 325 additions and 268 deletions

View file

@ -1,43 +1,5 @@
{
pkgs,
lib,
config,
...
}:
with lib;
with builtins; let
cfg = config.vim.autopairs;
in {
options.vim = {
autopairs = {
enable = mkOption {
type = types.bool;
default = false;
description = "enable autopairs";
};
type = mkOption {
type = types.enum ["nvim-autopairs"];
default = "nvim-autopairs";
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
};
};
};
config =
mkIf cfg.enable
{
vim.startPlugins = ["nvim-autopairs"];
vim.luaConfigRC.autopairs = nvim.dag.entryAnywhere ''
require("nvim-autopairs").setup{}
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
require('nvim-autopairs.completion.compe').setup({
map_cr = true,
map_complete = true,
auto_select = false,
})
''}
'';
};
_: {
imports = [
./nvim-autopairs
];
}