diff --git a/config/plugins.nix b/config/plugins.nix index 48a9578..cabec4e 100644 --- a/config/plugins.nix +++ b/config/plugins.nix @@ -4,6 +4,9 @@ undotree.enable = true; bufferline.enable = true; web-devicons.enable = true; + + cmp-nvim-lsp.enable = true; + cmp-path.enable = true; }; plugins.gitsigns = { @@ -26,6 +29,66 @@ enable = true; settings.highlight.enable = true; }; + plugins.friendly-snippets = { + enable = true; + }; + plugins.luasnip = { + enable = true; + settings = { + enable_autosnippets = true; + store_selection_keys = ""; + }; + }; + plugins.cmp = { + enable = true; + settings = { + autoEnableSources = true; + snippet = { + expand = '' + function(args) + require('luasnip').lsp_expand(args.body) + end + ''; + }; + sources = [ + { name = "nvim_lsp"; } + { + name = "path"; # file system paths + keywordLength = 2 ; + } + { + name = "luasnip"; # snippets + keywordLength = 2; + } + ]; + + mapping = { + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; + "" = '' + cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }) + ''; + "" = '' + cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }) + ''; + }; + }; + }; colorschemes.catppuccin = { enable = true;