2024-02-12 09:42:58 +00:00
|
|
|
{ config, lib, pkgs, helpers, ... }:
|
2024-01-28 11:42:57 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
nixvimCfg = config.nixvimConfigs.fiesta;
|
|
|
|
cfg = nixvimCfg.setups.completion;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.nixvimConfigs.fiesta.setups.completion.enable =
|
|
|
|
lib.mkEnableOption "debugging setup for Fiesta NixVim";
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
{
|
2024-03-07 10:44:48 +00:00
|
|
|
plugins.cmp = {
|
2024-01-28 11:42:57 +00:00
|
|
|
enable = true;
|
|
|
|
autoEnableSources = true;
|
|
|
|
|
2024-03-07 10:44:48 +00:00
|
|
|
settings.mapping = {
|
2024-01-28 11:42:57 +00:00
|
|
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
2024-02-12 09:42:58 +00:00
|
|
|
"<C-Space>" = "cmp.mapping.complete()";
|
2024-01-28 11:42:57 +00:00
|
|
|
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
|
|
|
"<C-u>" = "cmp.mapping.scroll_docs(4)";
|
|
|
|
"<C-g>" = "cmp.mapping.close()";
|
2024-03-07 10:44:48 +00:00
|
|
|
"<C-n>" = "cmp.mapping.select_next_item()";
|
|
|
|
"<C-p>" = "cmp.mapping.select_prev_item()";
|
|
|
|
"<Tab>" = "cmp.mapping.select_next_item()";
|
|
|
|
"<S-Tab>" = "cmp.mapping.select_prev_item()";
|
2024-01-28 11:42:57 +00:00
|
|
|
};
|
|
|
|
|
2024-03-07 10:44:48 +00:00
|
|
|
settings.sources = [
|
|
|
|
{ name = "nvim_lsp"; }
|
|
|
|
{ name = "path"; }
|
|
|
|
{ name = "buffer"; }
|
2024-01-28 11:42:57 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# All of the typical completion sources I would need.
|
|
|
|
plugins.cmp-buffer.enable = true;
|
|
|
|
plugins.cmp-path.enable = true;
|
|
|
|
plugins.cmp-vim-lsp.enable = true;
|
|
|
|
plugins.cmp-nvim-lua.enable = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
(lib.mkIf nixvimCfg.setups.debugging.enable {
|
|
|
|
plugins.cmp-dap.enable = true;
|
|
|
|
})
|
|
|
|
|
2024-02-04 11:48:21 +00:00
|
|
|
(lib.mkIf nixvimCfg.setups.snippets.enable {
|
2024-03-07 10:44:48 +00:00
|
|
|
plugins.cmp.settings = {
|
|
|
|
snippet.expand = ''
|
|
|
|
function(args)
|
|
|
|
require('luasnip').lsp_expand(args.body)
|
|
|
|
end
|
|
|
|
'';
|
2024-02-04 11:48:21 +00:00
|
|
|
|
2024-03-07 10:44:48 +00:00
|
|
|
sources = [{ name = "luasnip"; }];
|
|
|
|
};
|
2024-02-12 09:42:58 +00:00
|
|
|
|
|
|
|
plugins.cmp_luasnip.enable = true;
|
2024-02-04 11:48:21 +00:00
|
|
|
})
|
|
|
|
|
2024-01-28 11:42:57 +00:00
|
|
|
(lib.mkIf nixvimCfg.setups.treesitter.enable {
|
|
|
|
plugins.cmp-treesitter.enable = true;
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
}
|