mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-28 10:18:25 -05:00
neovim: support choice nodes for luasnip
Also turn on short keys for moving between windows
This commit is contained in:
parent
af695b83db
commit
ac38c5dcc9
@ -38,10 +38,10 @@ wk.register({
|
||||
L = {'$', 'End of the line'},
|
||||
|
||||
-- Easier moving between windows
|
||||
-- ['<C-h>'] = {'<C-w>h', 'Go to the left window'},
|
||||
-- ['<C-l>'] = {'<C-w>l', 'Go to the right window'},
|
||||
-- ['<C-j>'] = {'<C-w>j', 'Go to the down window'},
|
||||
-- ['<C-k>'] = {'<C-w>k', 'Go to the up window'},
|
||||
['<C-h>'] = {'<C-w>h', 'Go to the left window'},
|
||||
['<C-l>'] = {'<C-w>l', 'Go to the right window'},
|
||||
['<C-j>'] = {'<C-w>j', 'Go to the down window'},
|
||||
['<C-k>'] = {'<C-w>k', 'Go to the up window'},
|
||||
|
||||
-- Copy the whole buffer
|
||||
['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy whole buffer'},
|
||||
|
@ -70,6 +70,21 @@ function M.cmp_conf()
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
-- Change choice nodes for luasnip
|
||||
['<C-h>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.choice_active() then
|
||||
vim.fn.feedkeys(t('<Plug>luasnip-prev-choice'), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
['<C-l>'] = cmp.mapping(function(fallback)
|
||||
if luasnip.choice_active() then
|
||||
vim.fn.feedkeys(t('<Plug>luasnip-next-choice'), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
-- supertab-like mapping
|
||||
['<Tab>'] = 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'
|
||||
|
Loading…
Reference in New Issue
Block a user