# HG changeset patch # User Meredith Howard # Date 1677091325 21600 # Node ID 8b90bfdedd2bbc9742dffff98afd9b0708b8208b # Parent e55463fb35e2245d8f5f92fea7d1ad2a23b38730 spin out completion.lua diff --git a/.config/nvim/lua/plugins/completion.lua b/.config/nvim/lua/plugins/completion.lua new file mode 100644 --- /dev/null +++ b/.config/nvim/lua/plugins/completion.lua @@ -0,0 +1,53 @@ +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-calc", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lsp-signature-help", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-omni", + "hrsh7th/cmp-path", + "quangnguyen30192/cmp-nvim-tags", + }, + opts = function() + local cmp = require("cmp") + return { + completion = { + completeopt = "menu,menuone,noinsert,noselect", + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({select = true}), + [""] = function(fallback) + if cmp.visible() then + cmp.confirm({select = false}, function() + vim.api.nvim_feedkeys(" ", "n", false) + end) + end + fallback() + end, + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "nvim_lsp_signature_help" }, + { name = "nvim_lua" }, + }, { + { name = "calc" }, + { name = "buffer" }, + { name = "path" }, + }, { + { name = "tags" }, + { name = "omni" }, + }), + } + end, + }, +} + diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -19,55 +19,4 @@ return { }) end, }, - - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-calc", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lsp-signature-help", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-omni", - "hrsh7th/cmp-path", - "quangnguyen30192/cmp-nvim-tags", - }, - opts = function() - local cmp = require("cmp") - return { - completion = { - completeopt = "menu,menuone,noinsert,noselect", - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({select = true}), - [""] = function(fallback) - if cmp.visible() then - cmp.confirm({select = false}, function() - vim.api.nvim_feedkeys(" ", "n", false) - end) - end - fallback() - end, - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "nvim_lsp_signature_help" }, - { name = "nvim_lua" }, - }, { - { name = "calc" }, - { name = "buffer" }, - { name = "path" }, - }, { - { name = "tags" }, - { name = "omni" }, - }), - } - end, - }, }