mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2025-02-26 14:29:33 -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'},
|
L = {'$', 'End of the line'},
|
||||||
|
|
||||||
-- Easier moving between windows
|
-- Easier moving between windows
|
||||||
-- ['<C-h>'] = {'<C-w>h', 'Go to the left window'},
|
['<C-h>'] = {'<C-w>h', 'Go to the left window'},
|
||||||
-- ['<C-l>'] = {'<C-w>l', 'Go to the right window'},
|
['<C-l>'] = {'<C-w>l', 'Go to the right window'},
|
||||||
-- ['<C-j>'] = {'<C-w>j', 'Go to the down window'},
|
['<C-j>'] = {'<C-w>j', 'Go to the down window'},
|
||||||
-- ['<C-k>'] = {'<C-w>k', 'Go to the up window'},
|
['<C-k>'] = {'<C-w>k', 'Go to the up window'},
|
||||||
|
|
||||||
-- Copy the whole buffer
|
-- Copy the whole buffer
|
||||||
['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy 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-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-e>'] = cmp.mapping.close(),
|
['<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
|
-- supertab-like mapping
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 then
|
||||||
@ -123,9 +138,23 @@ function M.autopairs_conf()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.snippets_conf()
|
function M.snippets_conf()
|
||||||
|
local types = require('luasnip.util.types')
|
||||||
|
|
||||||
require('luasnip').config.set_config({
|
require('luasnip').config.set_config({
|
||||||
updateevents = 'TextChanged, TextChangedI',
|
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 vscode-like snippets from 'friendly-snippets'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user