Completion nvim-cmp: modified shortcuts, added :/ and :: completion
This commit is contained in:
@@ -14,14 +14,22 @@ cmp.setup({
|
|||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
-- Use <C-b/f> to scroll the docs
|
-- Use <C-b/f> to scroll the docs
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
-- Use <C-k/j> to switch in items
|
-- also scroll docs with page up / down
|
||||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
['<PageUp>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
['<PageDown>'] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
|
['<Esc>'] = cmp.mapping.abort(),
|
||||||
|
|
||||||
-- Use <CR>(Enter) to confirm selection
|
-- Use <CR>(Enter) to confirm selection
|
||||||
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
@@ -84,3 +92,24 @@ cmp.setup({
|
|||||||
{ name = 'sonicpi' }, -- for sonic-pi integration
|
{ name = 'sonicpi' }, -- for sonic-pi integration
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
}),
|
||||||
|
matching = { disallow_symbol_nonprefix_matching = false }
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user