diff options
Diffstat (limited to 'common/home/programs/nixvim/plugins/cmp.nix')
| -rw-r--r-- | common/home/programs/nixvim/plugins/cmp.nix | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/common/home/programs/nixvim/plugins/cmp.nix b/common/home/programs/nixvim/plugins/cmp.nix new file mode 100644 index 0000000..27cca04 --- /dev/null +++ b/common/home/programs/nixvim/plugins/cmp.nix @@ -0,0 +1,45 @@ +{ ... }: +{ + enable = true; + autoEnableSources = true; + settings = { + mapping = { + "<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 })"; + "<Tab>" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", "s" }) + ''; + "<S-Tab>" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }) + ''; + }; + snippet = { + expand = '' + function(args) + require('luasnip').lsp_expand(args.body) + end + ''; + }; + sources = [ + { name = "nvim_lsp"; } + { name = "luasnip"; } + { name = "path"; } + { name = "buffer"; } + ]; + }; +} |