Created
February 3, 2025 16:22
-
-
Save RiteshChepuri/f336d2351460d906982b60d6a8a87207 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"saghen/blink.cmp", | |
dependencies = { | |
{ | |
'L3MON4D3/LuaSnip', | |
version = 'v2.*', | |
dependencies = { | |
'rafamadriz/friendly-snippets', | |
config = function() | |
require('luasnip.loaders.from_vscode').lazy_load({ paths = { vim.fn.stdpath 'config' .. '/snippets' } }) | |
end | |
}, | |
config = function() | |
require('conf.luasnip') | |
end, | |
} | |
}, | |
version = "*", | |
---@module 'blink.cmp' | |
---@type blink.cmp.Config | |
opts = { | |
snippets = { preset = 'luasnip' }, | |
-- appearance = { | |
-- use_nvim_cmp_as_default = true, | |
-- nerd_font_variant = 'mono' | |
-- }, | |
completion = { | |
list = { | |
selection = { | |
preselect = false | |
} | |
}, | |
accept = { | |
auto_brackets = { | |
enabled = false, | |
}, | |
}, | |
menu = { | |
border = 'rounded', | |
draw = { | |
-- padding = 1, | |
-- gap = 4, | |
columns = { {"kind_icon", "label", "label_description", gap = 1 }, { "kind", gap = 1 } }, | |
components = { | |
kind = { | |
text = function(ctx) | |
local len = 10 - string.len(ctx.kind) | |
local space = string.rep(" ", len) | |
return ctx.kind .. space .. '[' .. ctx.source_name .. ']' | |
end | |
} | |
}, | |
} | |
}, | |
documentation = { | |
window = { border = 'rounded' }, | |
auto_show = true, | |
auto_show_delay_ms = 0, | |
}, | |
}, | |
keymap = { | |
["<C-e>"] = { "hide", "fallback" }, | |
["<CR>"] = { | |
function(cmp) | |
local mode = vim.api.nvim_get_mode().mode | |
if mode == 'c' then | |
return nil | |
end | |
local selected_item = require('blink.cmp.completion.list').get_selected_item() | |
if cmp.is_visible then | |
if selected_item ~= nil then | |
return cmp.accept() | |
else | |
return cmp.accept({ index = 1 }) | |
end | |
end | |
end, | |
"fallback" | |
}, | |
["<Tab>"] = { | |
function(cmp) | |
return cmp.select_next() | |
end, | |
"snippet_forward", | |
"fallback", | |
}, | |
["<S-Tab>"] = { | |
function(cmp) | |
return cmp.select_prev() | |
end, | |
"snippet_backward", | |
"fallback", | |
}, | |
}, | |
sources = { | |
default = { 'snippets', 'lsp', 'path', 'buffer' }, | |
providers = { | |
snippets = { | |
min_keyword_length = 1, | |
score_offset = 4, | |
}, | |
lsp = { | |
min_keyword_length = 0, | |
score_offset = 3, | |
name = "LSP", | |
module = "blink.cmp.sources.lsp", | |
fallbacks = { }, | |
}, | |
path = { | |
min_keyword_length = 0, | |
score_offset = 2, | |
}, | |
buffer = { | |
min_keyword_length = 1, | |
score_offset = 1, | |
}, | |
}, | |
}, | |
}, | |
opts_extend = { "sources.default" } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment