mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-07 10:51:36 +00:00
modules: make lib calls explicit where possible
This commit is contained in:
parent
bf1118eb28
commit
024e1a6845
41 changed files with 245 additions and 203 deletions
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./nvim-autopairs
|
||||
];
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim optionalString boolToString;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString;
|
||||
|
||||
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 ''
|
||||
require("nvim-autopairs").setup{}
|
||||
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
|
||||
require('nvim-autopairs.completion.compe').setup({
|
||||
map_cr = ${boolToString cfg.nvim-compe.map_cr},
|
||||
map_complete = ${boolToString cfg.nvim-compe.map_complete},
|
||||
auto_select = ${boolToString cfg.nvim-compe.auto_select},
|
||||
})
|
||||
''}
|
||||
'';
|
||||
};
|
||||
vim.luaConfigRC.autopairs = entryAnywhere ''
|
||||
require("nvim-autopairs").setup{}
|
||||
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
|
||||
-- nvim-compe integration
|
||||
require('nvim-autopairs.completion.compe').setup({
|
||||
map_cr = ${boolToString cfg.nvim-compe.map_cr},
|
||||
map_complete = ${boolToString cfg.nvim-compe.map_complete},
|
||||
auto_select = ${boolToString cfg.nvim-compe.auto_select},
|
||||
})
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-autopairs.nix
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) enum bool;
|
||||
in {
|
||||
options.vim = {
|
||||
autopairs = {
|
||||
enable = mkEnableOption "autopairs" // {default = false;};
|
||||
|
||||
type = mkOption {
|
||||
type = types.enum ["nvim-autopairs"];
|
||||
type = enum ["nvim-autopairs"];
|
||||
default = "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";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue