Switch to cmp-nvim
This commit is contained in:
parent
f9bb2843ed
commit
fead989bba
1 changed files with 45 additions and 6 deletions
|
@ -12,7 +12,9 @@ let
|
|||
};
|
||||
};
|
||||
mkLspLangConfig = name: cfg: ''
|
||||
require'lspconfig'["${name}"].setup(require'coq'.lsp_ensure_capabilities(${cfg.script}))
|
||||
local cfg = ${cfg.script}
|
||||
cfg["capabilities"] = require('cmp_nvim_lsp').default_capabilities()
|
||||
require'lspconfig'["${name}"].setup(cfg)
|
||||
'';
|
||||
mkLspLangConfigs = cfgs: lib.strings.concatStringsSep "\n" ((lib.attrsets.mapAttrsToList mkLspLangConfig cfgs));
|
||||
in
|
||||
|
@ -28,13 +30,50 @@ in
|
|||
config = mkIf cfg.lsp.enable {
|
||||
programs.neovim = {
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
nvim-snippy
|
||||
cmp-nvim-lsp
|
||||
cmp-buffer
|
||||
cmp-path
|
||||
cmp-tmux
|
||||
cmp-snippy
|
||||
{
|
||||
plugin = coq_nvim;
|
||||
plugin = nvim-cmp;
|
||||
config = ''
|
||||
vim.g.coq_settings = {
|
||||
xdg = true,
|
||||
auto_start = true
|
||||
}
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require('snippy').expand_snippet(args.body)
|
||||
end,
|
||||
},
|
||||
window = {},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'snippy' },
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name= 'tmux' }
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
'';
|
||||
type = "lua";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue