From 9b9eab0b94e1aa7202226002d8774603677d23ba Mon Sep 17 00:00:00 2001 From: Naz Date: Sat, 8 Feb 2025 11:49:10 +0100 Subject: =?UTF-8?q?=E2=9C=A8feat:=20add=20LSP=20and=20IDEish=20plugins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/plugins/completions.lua | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lua/plugins/completions.lua (limited to 'lua/plugins/completions.lua') diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua new file mode 100644 index 0000000..5aa87aa --- /dev/null +++ b/lua/plugins/completions.lua @@ -0,0 +1,52 @@ +return { + { + "hrsh7th/cmp-nvim-lsp", + lazy = false, + config = true, + }, + { + "L3MON4D3/LuaSnip", + lazy = false, + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) + end, + }, + { + "hrsh7th/nvim-cmp", + lazy = false, + config = function() + local cmp = require("cmp") + 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.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, +} -- cgit v1.2.3