mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-10 08:05:57 +01:00
43 lines
942 B
Nix
43 lines
942 B
Nix
{
|
|
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,
|
|
})
|
|
''}
|
|
'';
|
|
};
|
|
}
|