Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
c43a775035 | |||
41d8776474 | |||
920e9e8f09 | |||
b59fd0f8ed | |||
e48e9ac505 | |||
04c2a831c4 | |||
f188c5729e | |||
e48a6a0278 | |||
b3e5c54416 | |||
642434ff1f | |||
5e1d88a165 | |||
488ae9efb9 | |||
55f1bc79b1 |
96
lua/lazyvim/plugins/extras/coding/blink.lua
Normal file
96
lua/lazyvim/plugins/extras/coding/blink.lua
Normal file
@ -0,0 +1,96 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
enabled = false,
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
-- TODO: use release version
|
||||
-- version = "*",
|
||||
opts_extend = { "sources.completion.enabled_providers" },
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
-- add blink.compat to dependencies
|
||||
-- { "saghen/blink.compat", opts = {} },
|
||||
},
|
||||
event = "InsertEnter",
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
fuzzy = {
|
||||
prebuilt_binaries = {
|
||||
download = true,
|
||||
force_version = "v0.5.0",
|
||||
},
|
||||
},
|
||||
highlight = {
|
||||
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
||||
-- useful for when your theme doesn't support blink.cmp
|
||||
-- will be removed in a future release, assuming themes add support
|
||||
use_nvim_cmp_as_default = false,
|
||||
},
|
||||
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = "mono",
|
||||
windows = {
|
||||
autocomplete = {
|
||||
draw = "reversed",
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
|
||||
-- experimental auto-brackets support
|
||||
accept = { auto_brackets = { enabled = true } },
|
||||
|
||||
-- experimental signature help support
|
||||
-- trigger = { signature_help = { enabled = true } }
|
||||
sources = {
|
||||
completion = {
|
||||
-- remember to enable your providers here
|
||||
enabled_providers = { "lsp", "path", "snippets", "buffer" },
|
||||
},
|
||||
},
|
||||
|
||||
keymap = {
|
||||
preset = "enter",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add icons
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
opts = function(_, opts)
|
||||
opts.kind_icons = LazyVim.config.icons.kinds
|
||||
end,
|
||||
},
|
||||
|
||||
-- lazydev
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
opts = {
|
||||
sources = {
|
||||
completion = {
|
||||
-- add lazydev to your completion providers
|
||||
enabled_providers = { "lazydev" },
|
||||
},
|
||||
providers = {
|
||||
lsp = {
|
||||
-- dont show LuaLS require statements when lazydev has items
|
||||
fallback_for = { "lazydev" },
|
||||
},
|
||||
lazydev = {
|
||||
name = "LazyDev",
|
||||
module = "lazydev.integrations.blink",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -80,4 +80,44 @@ return {
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
optional = true,
|
||||
specs = {
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
keymap = { accept = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
windows = {
|
||||
ghost_text = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
keymap = {
|
||||
["<Tab>"] = {
|
||||
function(cmp)
|
||||
if cmp.is_in_snippet() then
|
||||
return cmp.accept()
|
||||
elseif require("copilot.suggestion").is_visible() then
|
||||
require("copilot.suggestion").accept()
|
||||
else
|
||||
return cmp.select_and_accept()
|
||||
end
|
||||
end,
|
||||
"snippet_forward",
|
||||
"fallback",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -184,11 +184,13 @@ return {
|
||||
|
||||
local servers = opts.servers
|
||||
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
local has_blink, blink = pcall(require, "blink.cmp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
||||
has_blink and blink.get_lsp_capabilities() or {},
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
|
@ -4,6 +4,7 @@ local prios = {
|
||||
["lazyvim.plugins.extras.dap.core"] = 1,
|
||||
["lazyvim.plugins.extras.ui.edgy"] = 2,
|
||||
["lazyvim.plugins.extras.lang.typescript"] = 5,
|
||||
["lazyvim.plugins.extras.coding.blink"] = 5,
|
||||
["lazyvim.plugins.extras.formatting.prettier"] = 10,
|
||||
-- default priority is 50
|
||||
["lazyvim.plugins.extras.editor.aerial"] = 100,
|
||||
|
@ -71,9 +71,17 @@ function M.add_missing_snippet_docs(window)
|
||||
end
|
||||
|
||||
function M.visible()
|
||||
---@module 'blink.cmp'
|
||||
local blink = package.loaded["blink.cmp"]
|
||||
if blink then
|
||||
return blink.windows and blink.windows.autocomplete.win:is_open()
|
||||
end
|
||||
---@module 'cmp'
|
||||
local cmp = package.loaded["cmp"]
|
||||
return cmp and cmp.core.view:visible()
|
||||
if cmp then
|
||||
return cmp.core.view:visible()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- This is a better implementation of `cmp.confirm`:
|
||||
|
Reference in New Issue
Block a user