diff options
Diffstat (limited to 'lua/plugins/cmp.lua')
| -rw-r--r-- | lua/plugins/cmp.lua | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 4f9d8f4..e3305ce 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -19,22 +19,19 @@ return { }, { 'hrsh7th/nvim-cmp', - event = 'InsertEnter', + event = { + 'InsertEnter', + 'CmdlineEnter', + }, dependencies = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'FelipeLema/cmp-async-path', 'saadparwaiz1/cmp_luasnip', 'L3MON4D3/LuaSnip', + 'micangl/cmp-vimtex', }, opts = function() - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and - vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil - end - local luasnip = require('luasnip') local cmp = require('cmp') @@ -45,16 +42,17 @@ return { end, }, mapping = cmp.mapping.preset.insert({ - ['<Space>'] = cmp.mapping.confirm({ select = false }), + ['<S-Space>'] = cmp.mapping.confirm({ select = false }), ['<Tab>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ['jk'] = cmp.mapping.abort(), }), sources = cmp.config.sources({ - { name = 'nvim_lsp' }, { name = 'luasnip' }, - { name = 'buffer' }, + { name = 'vimtex', }, { name = 'async_path' }, + { name = 'nvim_lsp' }, + { name = 'buffer' }, }), formatting = { format = function(_, item) |
