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.
|
||||
end,
|
||||
},
|
||||
|
||||
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Use <C-b/f> to scroll the docs
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
-- Use <C-k/j> to switch in items
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
-- also scroll docs with page up / down
|
||||
['<PageUp>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<PageDown>'] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
['<Esc>'] = cmp.mapping.abort(),
|
||||
|
||||
-- Use <CR>(Enter) to confirm selection
|
||||
-- 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
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- 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