Advertisement
Guest User

blink cmp setup + luasnip

a guest
May 22nd, 2025
41
0
343 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.22 KB | None | 0 0
  1. return {
  2.     {
  3.         "saghen/blink.cmp",
  4.         version = "1.*",
  5.         ---@module 'blink.cmp'
  6.         ---@type blink.cmp.Config
  7.         opts = {
  8.             keymap = {
  9.                 preset = "none",
  10.                
  11.                 ["<Tab>"] = {
  12.                     "snippet_forward",
  13.                     "fallback",
  14.                 },
  15.  
  16.                 ["<S-Tab>"] = {
  17.                     "snippet_backward",
  18.                     "fallback",
  19.                 },
  20.                 ["<C-n>"] = {
  21.                     "select_next",
  22.                     "fallback",
  23.                 },
  24.  
  25.                 ["<C-j>"] = {
  26.                     "select_next",
  27.                     "fallback",
  28.                 },
  29.                 ["<C-k>"] = {
  30.                     "select_prev",
  31.                     "fallback",
  32.                 },
  33.                 -- toggle signature help
  34.                 ["<C-s>"] = {
  35.                     function(cmp)
  36.                         cmp.show_signature()
  37.                     end,
  38.                     "fallback",
  39.                 },
  40.                 -- ctrl+Space to accept a suggestion, ctrl y is not convenient to press
  41.                 ["<C-Space>"] = {
  42.                     function(cmp)
  43.                         cmp.accept()
  44.                     end,
  45.                     -- "fallback", --dont enable this, the default fallback kinda fks the buffers a bit
  46.                 },
  47.             },
  48.             appearance = {
  49.                 nerd_font_variant = "mono",
  50.                 kind_icons = {
  51.                     -- overriding the default snippet icon
  52.                     Snippet = "",
  53.                 },
  54.             },
  55.             signature = { enabled = true },
  56.             -- (Default) Only show the documentation popup when manually triggered
  57.  
  58.             completion = {
  59.                 documentation = { auto_show = true },
  60.                 ghost_text = { enabled = false, show_without_selection = false },
  61.                 menu = {
  62.                     draw = {
  63.                         components = {
  64.                             kind_icon = {
  65.                                 text = function(ctx)
  66.                                     local icon = ctx.kind_icon
  67.                                     return icon .. " / " .. ctx.kind .. ctx.icon_gap
  68.                                 end,
  69.                             },
  70.                         },
  71.                     },
  72.                 },
  73.             },
  74.  
  75.             -- Default list of enabled providers defined so that you can extend it
  76.             -- elsewhere in your config, without redefining it, due to `opts_extend`
  77.             sources = {
  78.                 default = {
  79.                     "lsp",
  80.                     "path",
  81.                     "snippets",
  82.                     "buffer",
  83.                 },
  84.             },
  85.             fuzzy = { implementation = "lua" },
  86.         },
  87.         opts_extend = { "sources.default" },
  88.     },
  89.     {
  90.         "L3MON4D3/LuaSnip",
  91.         build = (function()
  92.             if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
  93.                 return
  94.             end
  95.             return "make install_jsregexp"
  96.         end)(),
  97.         dependencies = {
  98.             {
  99.                 "rafamadriz/friendly-snippets",
  100.                 config = function()
  101.                     require("luasnip.loaders.from_vscode").lazy_load()
  102.                 end,
  103.             },
  104.         },
  105.     }
  106. }
  107.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement