only enable nvim_lsp cmp source on desktop

This commit is contained in:
Charlotte 🦝 Delenk 2023-04-13 09:36:21 +01:00
parent 99f633d3df
commit 324ce79bd6
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
3 changed files with 26 additions and 16 deletions

View file

@ -89,6 +89,8 @@ in {
"config.undodir"
];
vim.g.isDesktop = config.isDesktop;
output.path.path = with pkgs; [ripgrep];
};
options.isDesktop = lib.options.mkEnableOption "desktop integration and LSP";

View file

@ -1,12 +1,22 @@
{pkgs, ...}: {
output.plugins = with pkgs.vimPlugins; [
{
pkgs,
config,
lib,
...
}: {
output.plugins = with pkgs.vimPlugins;
[
nvim-cmp
cmp-cmdline
cmp-path
cmp-buffer
cmp-nvim-lsp
cmp_luasnip
cmp-git
];
]
++ (
if config.isDesktop
then [cmp-nvim-lsp]
else []
);
extraLuaModules = ["config.cmp"];
}

View file

@ -19,12 +19,10 @@ cmp.setup({
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
sources = cmp.config.sources(
vim.g.isDesktop and {{ name = 'nvim_lsp' }} or {},
{
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
})