diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index 37d1024..1440a97 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -38,10 +38,10 @@ wk.register({ L = {'$', 'End of the line'}, -- Easier moving between windows - -- [''] = {'h', 'Go to the left window'}, - -- [''] = {'l', 'Go to the right window'}, - -- [''] = {'j', 'Go to the down window'}, - -- [''] = {'k', 'Go to the up window'}, + [''] = {'h', 'Go to the left window'}, + [''] = {'l', 'Go to the right window'}, + [''] = {'j', 'Go to the down window'}, + [''] = {'k', 'Go to the up window'}, -- Copy the whole buffer [''] = {'%y+', 'Copy whole buffer'}, diff --git a/home/.config/nvim/lua/modules/completion.lua b/home/.config/nvim/lua/modules/completion.lua index fadb8dc..c06dfe9 100644 --- a/home/.config/nvim/lua/modules/completion.lua +++ b/home/.config/nvim/lua/modules/completion.lua @@ -70,6 +70,21 @@ function M.cmp_conf() [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.close(), + -- Change choice nodes for luasnip + [''] = cmp.mapping(function(fallback) + if luasnip.choice_active() then + vim.fn.feedkeys(t('luasnip-prev-choice'), '') + else + fallback() + end + end, {'i', 's'}), + [''] = cmp.mapping(function(fallback) + if luasnip.choice_active() then + vim.fn.feedkeys(t('luasnip-next-choice'), '') + else + fallback() + end + end, {'i', 's'}), -- supertab-like mapping [''] = cmp.mapping(function(fallback) if vim.fn.pumvisible() == 1 then @@ -123,9 +138,23 @@ function M.autopairs_conf() end function M.snippets_conf() + local types = require('luasnip.util.types') + require('luasnip').config.set_config({ updateevents = 'TextChanged, TextChangedI', - history = true + history = true, + ext_opts = { + [types.choiceNode] = { + active = { + virt_text = {{'●', 'Number'}} + } + }, + [types.insertNode] = { + active = { + virt_text = {{'●', 'Keyword'}} + } + } + } }) -- Loading vscode-like snippets from 'friendly-snippets'