From e3896e07385cbc1327dcd23e1e28ca17f710b709 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Wed, 26 Jun 2024 19:54:00 +0300 Subject: Accidentally placed the nvim files in the wrong place, fixed now --- .config/nvim/lua/plugins/completions.lua | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .config/nvim/lua/plugins/completions.lua (limited to '.config/nvim/lua/plugins/completions.lua') diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua new file mode 100644 index 0000000..51b7a78 --- /dev/null +++ b/.config/nvim/lua/plugins/completions.lua @@ -0,0 +1,50 @@ +return { + { + "hrsh7th/cmp-nvim-lsp" + }, + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets" + } + }, + { + "hrsh7th/nvim-cmp", + opts = function(_, opts) + -- Setup options for lazydev.nvim + opts.sources = opts.sources or {} + table.insert(opts.sources, { + name = "lazydev", + group_index = 0, + }) + end, + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true}), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { { name = "buffer"} }) + }) + end + } +} -- cgit v1.3.1