2023-02-27 15:53:34 +01:00
|
|
|
{
|
|
|
|
config,
|
2024-02-26 06:05:23 +01:00
|
|
|
lib,
|
2023-02-27 15:53:34 +01:00
|
|
|
...
|
2023-11-07 01:50:27 +01:00
|
|
|
}: let
|
2024-02-26 06:05:23 +01:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.trivial) boolToString;
|
2023-11-07 01:50:27 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
cfg = config.vim.autopairs;
|
|
|
|
in {
|
2024-02-26 06:05:23 +01:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim.startPlugins = ["nvim-autopairs"];
|
2023-02-27 15:53:34 +01:00
|
|
|
|
2024-02-26 06:05:23 +01:00
|
|
|
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},
|
|
|
|
})
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
};
|
2023-02-27 15:53:34 +01:00
|
|
|
}
|