diff options
| author | Nanderty <psopka@sopka.ch> | 2024-01-31 15:47:52 +0100 |
|---|---|---|
| committer | Nanderty <psopka@sopka.ch> | 2024-01-31 15:47:52 +0100 |
| commit | 0d00ee23f35046f8465cb8302b6795d15227dfda (patch) | |
| tree | 3f3042de3a141e491bc98acd91490a263939a74d /lua/plugins/cmp.lua | |
| parent | 42383b96d9a1b929080824946340d7459d49ac20 (diff) | |
| download | neovim-config-0d00ee23f35046f8465cb8302b6795d15227dfda.tar.gz neovim-config-0d00ee23f35046f8465cb8302b6795d15227dfda.tar.bz2 neovim-config-0d00ee23f35046f8465cb8302b6795d15227dfda.zip | |
Snippets and general improvements
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) |
