aboutsummaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/eugenetriguba/plugins/blink.lua
blob: 30de968ede1c498faba71dd9f4fb340cd4f7e670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
vim.api.nvim_create_autocmd('PackChanged', {
  callback = function(args)
    local spec = args.data.spec
    if spec and spec.name == 'blink.cmp' then
      if args.data.kind == 'install' or args.data.kind == 'update' then
        vim.notify('Building blink.cmp...', vim.log.levels.INFO)
        vim.system({ 'cargo', 'build', '--release' }, { cwd = spec.path, text = true }, function(result)
          if result.code == 0 then
            vim.notify('blink.cmp build successful!', vim.log.levels.INFO)
          else
            vim.notify('blink.cmp build failed: ' .. (result.stderr or ''), vim.log.levels.ERROR)
          end
        end)
      end
    end
  end,
})

vim.pack.add {
  {
    name = 'blink.cmp',
    src = 'https://github.com/saghen/blink.cmp',
    version = 'v1.10.1',
  },
  {
    name = 'LuaSnip',
    src = 'https://github.com/L3MON4D3/LuaSnip',
  },
  {
    name = 'friendly-snippets',
    src = 'https://github.com/rafamadriz/friendly-snippets',
  },
  {
    name = 'lazydev.nvim',
    src = 'https://github.com/folke/lazydev.nvim',
  },
}

require('luasnip.loaders.from_vscode').lazy_load()
require('blink.cmp').setup {
  keymap = {
    preset = 'default',
  },
  appearance = {
    nerd_font_variant = 'mono',
  },
  completion = {
    documentation = { auto_show = true, auto_show_delay_ms = 500 },
  },
  sources = {
    default = {
      'lsp',
      'path',
      'snippets',
      'lazydev',
    },
    providers = {
      lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
    },
  },
  snippets = { preset = 'luasnip' },
  fuzzy = { implementation = 'prefer_rust_with_warning' },
  signature = { enabled = true },
}