|
@@ -279,55 +279,33 @@ require('treesitter-context').setup({
|
|
|
})
|
|
|
|
|
|
-- completion
|
|
|
-local cmp = require('cmp')
|
|
|
-local cmp_types = require('cmp.types')
|
|
|
-
|
|
|
-function sort_label(entry1, entry2)
|
|
|
- local diff = vim.stricmp(entry1.completion_item.label, entry2.completion_item.label)
|
|
|
- if diff < 0 then
|
|
|
- return true
|
|
|
- elseif diff > 0 then
|
|
|
- return false
|
|
|
- end
|
|
|
-end
|
|
|
-
|
|
|
-cmp.setup({
|
|
|
- snippet = {
|
|
|
- expand = function(args)
|
|
|
- vim.fn['vsnip#anonymous'](args.body)
|
|
|
- end,
|
|
|
+require('blink.cmp').setup({
|
|
|
+ cmdline = {
|
|
|
+ enabled = false,
|
|
|
},
|
|
|
- mapping = cmp.mapping.preset.insert({
|
|
|
- ['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
|
|
- ['<C-d>'] = cmp.mapping.scroll_docs(4),
|
|
|
- ['<C-Space>'] = cmp.mapping.complete(),
|
|
|
- ['<C-e>'] = cmp.mapping.abort(),
|
|
|
- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
|
- }),
|
|
|
- sources = cmp.config.sources({
|
|
|
- {
|
|
|
- name = "nvim_lsp",
|
|
|
- entry_filter = function(entry, ctx)
|
|
|
- -- don't autocomplete keywords
|
|
|
- return cmp_types.lsp.CompletionItemKind[entry:get_kind()] ~= 'Keyword'
|
|
|
- end
|
|
|
- },
|
|
|
- { name = "vsnip" },
|
|
|
- }),
|
|
|
completion = {
|
|
|
- autocomplete = false,
|
|
|
- },
|
|
|
- matching = {
|
|
|
- -- disable non-prefix matching
|
|
|
- disallow_fuzzy_matching = true,
|
|
|
- disallow_partial_matching = true,
|
|
|
- disallow_prefix_unmatching = true,
|
|
|
- },
|
|
|
- sorting = {
|
|
|
- comparators = {
|
|
|
- -- since we only have prefix matches, just sort the results
|
|
|
- sort_label,
|
|
|
+ documentation = {
|
|
|
+ auto_show = true,
|
|
|
+ auto_show_delay_ms = 500,
|
|
|
},
|
|
|
+ trigger = {
|
|
|
+ prefetch_on_insert = false,
|
|
|
+ show_on_keyword = false,
|
|
|
+ show_on_trigger_character = false,
|
|
|
+ },
|
|
|
+ menu = {
|
|
|
+ draw = {
|
|
|
+ columns = {
|
|
|
+ { "label", "label_description", gap = 1 },
|
|
|
+ { "kind" },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ keymap = {
|
|
|
+ ['<Enter>'] = { 'select_and_accept', 'fallback' },
|
|
|
+ ['<C-u>'] = { 'scroll_documentation_up', 'fallback_to_mappings' },
|
|
|
+ ['<C-d>'] = { 'scroll_documentation_down', 'fallback_to_mappings' },
|
|
|
},
|
|
|
})
|
|
|
|