{ nix2lua, vim, ... }: with nix2lua.lib; let defaultCmpKeymaps = { "" = call "cmp.mapping.scroll_docs" (- 4); "" = call "cmp.mapping.scroll_docs" 4; "" = call0 "cmp.mapping.complete"; "" = call0 "cmp.mapping.abort"; "" = call "cmp.mapping.confirm" { select = true; }; }; in { cmpKeymaps ? defaultCmpKeymaps , extraCmpKeymaps ? { } , cmpSources ? { } }: { luasnip = true; cmp-luasnip = true; nvim-cmp = [ (vim.opt "completeopt" [ "menu" "menuone" "noselect" ]) (local (set "cmp" (require "cmp"))) (pipe1 (var "cmp") (call "setup" { snippet.exand = lambda [ "args" ] (pipe1 (require "luasnip") (call "lsp_expand" (var "args"))); mapping = call "cmp.mapping.preset.insert" (cmpKeymaps // extraCmpKeymaps); sources = call "cmp.config.sources" cmpSources; }) ) ]; }