LazyVim.LazyVim/lua/lazyvim/plugins/extras/coding/blink.lua

110 lines
3.1 KiB
Lua
Raw Normal View History

2024-11-01 10:06:18 +01:00
return {
{
"hrsh7th/nvim-cmp",
enabled = false,
},
{
"saghen/blink.cmp",
2024-11-01 16:32:42 +01:00
opts_extend = { "sources.completion.enabled_providers" },
2024-11-01 10:06:18 +01:00
dependencies = {
"rafamadriz/friendly-snippets",
-- add blink.compat to dependencies
2024-11-01 20:59:26 +01:00
-- { "saghen/blink.compat", opts = {} },
2024-11-01 10:06:18 +01:00
},
2024-11-01 17:06:34 +01:00
event = "InsertEnter",
2024-11-01 10:06:18 +01:00
-- use a release tag to download pre-built binaries
2024-11-01 16:32:42 +01:00
version = "*",
2024-11-01 10:06:18 +01:00
-- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
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
2024-11-01 16:32:42 +01:00
nerd_font_variant = "mono",
2024-11-01 10:06:18 +01:00
windows = {
2024-11-01 17:19:48 +01:00
autocomplete = {
draw = "reversed",
},
2024-11-01 10:06:18 +01:00
documentation = {
auto_show = true,
},
ghost_text = {
enabled = true,
},
},
-- experimental auto-brackets support
accept = { auto_brackets = { enabled = true } },
2024-11-01 10:06:18 +01:00
-- experimental signature help support
-- trigger = { signature_help = { enabled = true } }
sources = {
completion = {
-- remember to enable your providers here
2024-11-01 16:32:42 +01:00
enabled_providers = { "lsp", "path", "snippets", "buffer" },
2024-11-01 10:06:18 +01:00
},
2024-11-01 16:32:42 +01:00
},
keymap = {
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide" },
["<C-y>"] = { "select_and_accept" },
["<CR>"] = { "select_and_accept", "fallback" },
["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },
["<C-p>"] = { "select_prev", "fallback" },
["<C-n>"] = { "select_next", "fallback" },
["<C-b>"] = { "scroll_documentation_up", "fallback" },
["<C-f>"] = { "scroll_documentation_down", "fallback" },
["<Tab>"] = { "snippet_forward", "fallback" },
["<S-Tab>"] = { "snippet_backward", "fallback" },
},
2024-11-01 16:32:42 +01:00
},
},
2024-11-01 10:06:18 +01:00
2024-11-01 16:39:18 +01:00
-- add icons
{
"saghen/blink.cmp",
opts = function(_, opts)
opts.kind_icons = LazyVim.config.icons.kinds
end,
},
2024-11-01 16:32:42 +01:00
-- lazydev
{
"saghen/blink.cmp",
opts = {
sources = {
completion = {
-- add lazydev to your completion providers
enabled_providers = { "lazydev" },
},
2024-11-01 10:06:18 +01:00
providers = {
2024-11-01 16:32:42 +01:00
lsp = {
-- dont show LuaLS require statements when lazydev has items
fallback_for = { "lazydev" },
},
2024-11-01 10:06:18 +01:00
lazydev = {
2024-11-01 16:32:42 +01:00
name = "LazyDev",
module = "lazydev.integrations.blink",
2024-11-01 10:06:18 +01:00
},
},
},
},
},
}