96 lines
3.3 KiB
Lua
96 lines
3.3 KiB
Lua
return {
|
|
"saghen/blink.cmp",
|
|
dependencies = {
|
|
"rafamadriz/friendly-snippets",
|
|
"L3MON4D3/LuaSnip",
|
|
},
|
|
-- enabled = false,
|
|
version = "*",
|
|
config = function()
|
|
require("blink-cmp").setup({
|
|
appearance = {
|
|
use_nvim_cmp_as_default = true,
|
|
nerd_font_variant = "mono",
|
|
},
|
|
keymap = {
|
|
preset = "default",
|
|
|
|
["<C-space>"] = {},
|
|
["<C-e>"] = {},
|
|
|
|
["<C-c>"] = { "show", "show_documentation", "hide_documentation" },
|
|
["<NL>"] = { "select_and_accept" },
|
|
|
|
["<Tab>"] = { "snippet_forward", "select_next", "fallback" },
|
|
["<S-Tab>"] = { "snippet_backward", "select_prev", "fallback" },
|
|
|
|
["<Up>"] = { "select_prev", "fallback" },
|
|
["<Down>"] = { "select_next", "fallback" },
|
|
},
|
|
completion = {
|
|
menu = {
|
|
border = "rounded",
|
|
},
|
|
documentation = {
|
|
auto_show = true,
|
|
window = {
|
|
border = "single",
|
|
},
|
|
},
|
|
},
|
|
snippets = {
|
|
preset = "luasnip",
|
|
expand = function(snippet)
|
|
require("luasnip").lsp_expand(snippet)
|
|
end,
|
|
active = function(filter)
|
|
if filter and filter.direction then
|
|
return require("luasnip").jumpable(filter.direction)
|
|
end
|
|
return require("luasnip").in_snippet()
|
|
end,
|
|
jump = function(direction)
|
|
require("luasnip").jump(direction)
|
|
end,
|
|
},
|
|
sources = {
|
|
default = { "lsp", "snippets", "buffer", "path" },
|
|
providers = {
|
|
lsp = {
|
|
name = "lsp",
|
|
enabled = true,
|
|
module = "blink.cmp.sources.lsp",
|
|
score_offset = 90,
|
|
},
|
|
snippets = {
|
|
name = "snippets",
|
|
enabled = true,
|
|
module = "blink.cmp.sources.snippets",
|
|
score_offset = 80,
|
|
},
|
|
buffer = {
|
|
name = "Buffer",
|
|
enabled = true,
|
|
module = "blink.cmp.sources.buffer",
|
|
score_offset = 70,
|
|
},
|
|
path = {
|
|
name = "Path",
|
|
module = "blink.cmp.sources.path",
|
|
score_offset = 3,
|
|
opts = {
|
|
trailing_slash = false,
|
|
label_trailing_slash = true,
|
|
get_cwd = function(context)
|
|
return vim.fn.expand(("#%d:p:h"):format(context.bufnr))
|
|
end,
|
|
show_hidden_files_by_default = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
opts_extend = { "sources.default" },
|
|
}
|