feat(extras): blink (#4680)

## Description

Extra to use [blink.cmp](https://github.com/Saghen/blink.cmp) instead of
**nvim-cmp**.

## Todo

- [x] tokyonight suport
- [x] basic integration
- [ ] check / update all cmp sources
- [ ] copilot and others integration 
- [x] native lazydev source

## Limitations

There's no copilot source, so instead when enabling both blink and
copilot:
- blink ghost text is disabled
- copilot suggestions are enabled
- use `<tab>` to navigate snippets and accept copilot completions 

## Related Issue(s)

- https://github.com/LazyVim/LazyVim/discussions/4679
This commit is contained in:
Folke Lemaitre
2024-11-02 09:54:55 +01:00
committed by GitHub
parent a66b44a9fe
commit ad52bf91bc
5 changed files with 148 additions and 1 deletions

View 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",
},
},
},
},
},
}