diff --git a/lazy-lock.json b/lazy-lock.json index 9e41e44..9f15b8e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -5,7 +5,6 @@ "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index b4b884e..7e9d847 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -4,20 +4,19 @@ return { event = 'InsertEnter', dependencies = { 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-nvim-lua', - { 'hrsh7th/cmp-nvim-lsp', dependencies = 'nvim-lspconfig' }, -- nvim-cmp source for neovim's built-in LSP - { 'hrsh7th/cmp-path', dependencies = 'nvim-cmp' }, - { 'hrsh7th/cmp-buffer', dependencies = 'nvim-cmp' }, -- nvim-cmp source for buffer words - { 'saadparwaiz1/cmp_luasnip', dependencies = 'LuaSnip' }, - { - 'L3MON4D3/LuaSnip', - event = 'InsertCharPre', - }, + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-buffer', + 'saadparwaiz1/cmp_luasnip', }, opts = function() + vim.api.nvim_set_hl(0, 'CmpGhostText', { link = 'Comment', default = true }) local cmp = require('cmp') local defaults = require('cmp.config.default')() return { + completion = { + completeopt = 'menu,menuone,noinsert', + }, snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) @@ -62,9 +61,18 @@ return { end, ---@param opts cmp.ConfigSchema config = function(_, opts) + local cmp = require('cmp') for _, source in ipairs(opts.sources) do source.group_index = source.group_index or 1 end - require('cmp').setup(opts) + cmp.setup(opts) + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' }, + }, { + { name = 'cmdline' }, + }), + }) end, } diff --git a/lua/plugins/luasnip.lua b/lua/plugins/luasnip.lua index 8af0fe1..689e7fd 100644 --- a/lua/plugins/luasnip.lua +++ b/lua/plugins/luasnip.lua @@ -2,7 +2,7 @@ return { 'L3MON4D3/LuaSnip', build = (not jit.os:find('Windows')) and "echo 'NOTE: jsregexp is optional, so not a big deal if it fails to build'; make install_jsregexp" - or nil, + or nil, dependencies = { 'rafamadriz/friendly-snippets', config = function() @@ -13,16 +13,18 @@ return { history = true, delete_check_events = 'TextChanged', }, - -- stylua: ignore - keys = { - { - "", - function() - return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" - end, - expr = true, silent = true, mode = "i", - }, - { "", function() require("luasnip").jump(1) end, mode = "s" }, - { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + -- stylua: ignore + keys = { + { + "", + function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, + expr = true, + silent = true, + mode = "i", }, + { "", function() require("luasnip").jump(1) end, mode = "s" }, + { "", function() require("luasnip").jump(-1) end, mode = { "i", "s" } }, + }, }