aboutsummaryrefslogtreecommitdiffstats
path: root/lua/plugins/completition.lua
blob: bfe51d5b80b58e532180eb290045fa8b0ca3ee75 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
return {
  "saghen/blink.cmp",
  -- optional: provides snippets for the snippet source
  dependencies = {
    "rafamadriz/friendly-snippets",
    { "L3MON4D3/LuaSnip", version = "v1.*" },
    "windwp/nvim-autopairs",
    {
      "zbirenbaum/copilot.lua",
      cmd = { "Copilot" },
      event = { "VeryLazy" },
      opts = { suggestion = { enabled = false }, panel = { enabled = false } },
    },
    -- Add blink.cmp copilot source
    "giuxtaposition/blink-cmp-copilot",
    -- Add blink.cmp latex source for LaTeX/VimTeX support
    "erooke/blink-cmp-latex",
  },

  -- use a release tag to download pre-built binaries
  version = "1.*",
  -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
  -- build = 'cargo build --release',

  event = "VeryLazy",

  ---@module 'blink.cmp'
  ---@type blink.cmp.Config
  opts = {
    -- Opciones de keymap disponibles:
    -- 'default' (actual) - Ctrl+y para aceptar, similar a built-in completions
    -- 'super-tab' - Tab para aceptar, similar a VSCode
    -- 'enter' - Enter para aceptar
    -- 'none' - Sin atajos automáticos (defines los tuyos)
    keymap = { preset = "default" },

    -- Todas las configuraciones de preset 'default' incluyen:
    -- Ctrl+space: Abrir menú o mostrar docs si ya está abierto
    -- Ctrl+n/Ctrl+p o ↑/↓: Seleccionar siguiente/anterior
    -- Ctrl+e: Ocultar menú
    -- Ctrl+k: Toggle signature help (si signature.enabled = true)

    appearance = {
      -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
      nerd_font_variant = "mono",
    },

    completion = {
      documentation = {
        auto_show = true,
        auto_show_delay_ms = 500,
        window = { border = "rounded" },
      },
      menu = {
        border = "rounded",
        draw = {
          columns = {
            { "label", "label_description", gap = 1 },
            { "kind_icon", "kind" },
          },
        },
      },
      ghost_text = { enabled = false },
    },

    -- Default list of enabled providers
    sources = {
      default = { "lsp", "path", "snippets", "buffer", "copilot" },
      per_filetype = {
        tex = { "lsp", "path", "snippets", "buffer", "latex" },
        bib = { "lsp", "path", "snippets", "buffer", "latex" },
        codecompanion = { "codecompanion" },
      },
      providers = {
        copilot = {
          name = "copilot",
          module = "blink-cmp-copilot",
          score_offset = 100,
          async = true,
        },
        latex = {
          name = "latex",
          module = "blink-cmp-latex",
        },
      },
    },

    snippets = { preset = "luasnip" },

    -- Experimental signature help support
    signature = { enabled = true },

    -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
    fuzzy = { implementation = "prefer_rust_with_warning" },
  },
  opts_extend = { "sources.default" },
}