mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-09 20:27:16 +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,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib) nvim;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString;
|
|
||||||
|
|
||||||
cfg = config.vim.autopairs;
|
cfg = config.vim.autopairs;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim.startPlugins = ["nvim-autopairs"];
|
vim.startPlugins = ["nvim-autopairs"];
|
||||||
|
|
||||||
vim.luaConfigRC.autopairs = entryAnywhere ''
|
vim.luaConfigRC.autopairs = nvim.dag.entryAnywhere ''
|
||||||
require("nvim-autopairs").setup{}
|
require("nvim-autopairs").setup{}
|
||||||
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
|
${optionalString (config.vim.autocomplete.type == "nvim-compe") ''
|
||||||
-- nvim-compe integration
|
require('nvim-autopairs.completion.compe').setup(${nvim.lua.expToLua cfg.setupOpts})
|
||||||
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,5 +1,5 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption mkRenamedOptionModule;
|
||||||
inherit (lib.types) enum bool;
|
inherit (lib.types) enum bool;
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim = {
|
||||||
|
|
@ -12,7 +12,11 @@ in {
|
||||||
description = "Set the autopairs type. Options: nvim-autopairs [nvim-autopairs]";
|
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 {
|
map_cr = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue