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" "config.undodir"
]; ];
vim.g.isDesktop = config.isDesktop;
output.path.path = with pkgs; [ripgrep]; output.path.path = with pkgs; [ripgrep];
}; };
options.isDesktop = lib.options.mkEnableOption "desktop integration and LSP"; options.isDesktop = lib.options.mkEnableOption "desktop integration and LSP";

View file

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

View file

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