modules: explicit lib usage

This commit is contained in:
raf 2024-02-20 02:05:36 +03:00
commit caf342adb1
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
27 changed files with 673 additions and 684 deletions

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./nvim-autopairs
];

View file

@ -1,18 +1,20 @@
{
lib,
config,
lib,
...
}: let
inherit (lib) mkIf nvim optionalString boolToString;
inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString;
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.autopairs;
in {
config =
mkIf (cfg.enable)
{
vim.startPlugins = ["nvim-autopairs"];
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-autopairs"];
vim.luaConfigRC.autopairs = nvim.dag.entryAnywhere ''
luaConfigRC.autopairs = entryAnywhere ''
require("nvim-autopairs").setup{}
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
require('nvim-autopairs.completion.compe').setup({
@ -23,4 +25,5 @@ in {
''}
'';
};
};
}

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./config.nix
./nvim-autopairs.nix

View file

@ -1,31 +1,37 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.tyoes) enum bool;
in {
options.vim = {
autopairs = {
enable = mkEnableOption "autopairs" // {default = false;};
enable = mkEnableOption "autopairs";
type = mkOption {
type = types.enum ["nvim-autopairs"];
type = enum ["nvim-autopairs"];
default = "nvim-autopairs";
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
description = ''
Set the autopairs type.
Options:
- nvim-autopairs [nvim-autopairs]
'';
};
nvim-compe = {
map_cr = mkOption {
type = types.bool;
type = bool;
default = true;
description = ''map <CR> on insert mode'';
};
map_complete = mkOption {
type = types.bool;
type = bool;
default = true;
description = "auto insert `(` after select function or method item";
};
auto_select = mkOption {
type = types.bool;
type = bool;
default = false;
description = "auto select first item";
};