mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-02 00:55:54 +00:00
feat(autopairs): custom setup opts
This commit is contained in:
parent
2ea98f643b
commit
3d350bcfe4
2 changed files with 9 additions and 11 deletions
|
|
@ -3,25 +3,19 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) nvim;
|
||||
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"];
|
||||
|
||||
vim.luaConfigRC.autopairs = entryAnywhere ''
|
||||
vim.luaConfigRC.autopairs = nvim.dag.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},
|
||||
})
|
||||
require('nvim-autopairs.completion.compe').setup(${nvim.lua.expToLua cfg.setupOpts})
|
||||
''}
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.options) mkEnableOption mkOption mkRenamedOptionModule;
|
||||
inherit (lib.types) enum bool;
|
||||
in {
|
||||
options.vim = {
|
||||
|
|
@ -12,7 +12,11 @@ in {
|
|||
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
|
||||
};
|
||||
|
||||
nvim-compe = {
|
||||
imports = [
|
||||
(mkRenamedOptionModule ["vim" "autopairs" "nvim-compe"] ["vim" "autopairs" "nvim-compe" "setupOpts"])
|
||||
];
|
||||
|
||||
nvim-compe.setupOpts = lib.nvim.types.mkPluginSetupOption {
|
||||
map_cr = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue