From 03b5fffc726f6b64babfb20ceec38ea8af2cf590 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Sun, 16 Jun 2024 14:42:58 -0400 Subject: [PATCH] Adding Frienly snips, autoclose and cleaning up lazy --- after/plugin/autoclose.lua | 5 +++++ after/plugin/cmp.lua | 26 ++++++++++++++++++++++++++ after/plugin/lsp.lua | 24 ------------------------ lua/pippy/lazy.lua | 12 +++++------- 4 files changed, 36 insertions(+), 31 deletions(-) create mode 100644 after/plugin/autoclose.lua create mode 100644 after/plugin/cmp.lua diff --git a/after/plugin/autoclose.lua b/after/plugin/autoclose.lua new file mode 100644 index 0000000..bc90ab8 --- /dev/null +++ b/after/plugin/autoclose.lua @@ -0,0 +1,5 @@ +require("autoclose").setup({ + keys = { + [">"] = { escape = false, close = false, pair = "<>", disabled_filetypes = {} }, + }, +}) diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua new file mode 100644 index 0000000..384a707 --- /dev/null +++ b/after/plugin/cmp.lua @@ -0,0 +1,26 @@ +local cmp = require('cmp') +local cmp_select = {behavior = cmp.SelectBehavior.Select} +local luasnip= require('luasnip') +require("luasnip.loaders.from_vscode").lazy_load() +-- +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + sources = { + {name = 'path'}, + {name = 'nvim_lsp'}, + {name = 'nvim_lua'}, + {name = 'luasnip'}, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete(), + }), +}) + + diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 1fffffd..f8150f7 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -62,28 +62,4 @@ require('mason-lspconfig').setup({ }, }) -local cmp = require('cmp') -local cmp_select = {behavior = cmp.SelectBehavior.Select} -local luasnip= require('luasnip') - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end - }, - sources = { - {name = 'path'}, - {name = 'nvim_lsp'}, - {name = 'nvim_lua'}, - {name = 'luasnip'}, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.complete(), - }), -}) - diff --git a/lua/pippy/lazy.lua b/lua/pippy/lazy.lua index 0fbef0f..154ff0a 100644 --- a/lua/pippy/lazy.lua +++ b/lua/pippy/lazy.lua @@ -35,19 +35,17 @@ require("lazy").setup({ 'nvim-lua/plenary.nvim' }, }, - { - "folke/neoconf.nvim", - cmd = "Neoconf" - }, - "folke/neodev.nvim", - {'akinsho/toggleterm.nvim', version = "*", config = true}, {"danymat/neogen", dependencies = "nvim-treesitter/nvim-treesitter", config = true}, {'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'}, {'hrsh7th/cmp-nvim-lsp'}, {'hrsh7th/nvim-cmp'}, - {'L3MON4D3/LuaSnip'}, + {'L3MON4D3/LuaSnip', dependencies ={ + 'rafamadriz/friendly-snippets', + 'saadparwaiz1/cmp_luasnip', + }}, + 'm4xshen/autoclose.nvim', 'lewis6991/gitsigns.nvim', {'xiyaowong/transparent.nvim'}, { 'numToStr/Comment.nvim', opts = {} },