Switched to blink.cmp
This commit is contained in:
@@ -93,9 +93,9 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.lsp.buf.hover({ border = window.border })
|
||||
end, { desc = "Hover Documentation" })
|
||||
vim.keymap.set("n", "<C-k>", function()
|
||||
vim.lsp.buf.signature_help({ border = border })
|
||||
end, { desc = "Signature Documentation" })
|
||||
-- vim.keymap.set("n", "<C-k>", function()
|
||||
-- vim.lsp.buf.signature_help({ border = border })
|
||||
-- end, { desc = "Signature Documentation" })
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
123
nvim/dot-config/nvim/lua/plugins/blink.lua
Normal file
123
nvim/dot-config/nvim/lua/plugins/blink.lua
Normal file
@@ -0,0 +1,123 @@
|
||||
local window = require("symbols.window")
|
||||
return {
|
||||
"saghen/blink.cmp",
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = "1.*",
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
-- keymap = { preset = "default" },
|
||||
keymap = {
|
||||
preset = "default",
|
||||
-- ["<C-u>"] = {function(cmp) cmp.scroll_documentation_up(4) end},
|
||||
-- ["<C-d>"] = {function(cmp) cmp.scroll_documentation_down(4) end},
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
["<C-u>"] = { "scroll_documentation_up" },
|
||||
["<C-d>"] = { "scroll_documentation_down" },
|
||||
|
||||
["<CR>"] = { "accept", "fallback" },
|
||||
["<Esc>"] = { "cancel", "fallback" },
|
||||
|
||||
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
|
||||
["<Up>"] = { "select_prev", "fallback" },
|
||||
["<Down>"] = { "select_next", "fallback" },
|
||||
["<C-p>"] = { "select_prev", "fallback_to_mappings" },
|
||||
["<C-n>"] = { "select_next", "fallback_to_mappings" },
|
||||
|
||||
-- TODO: Does not appear to work?
|
||||
["<C-k>"] = { "show_signature", "hide_signature", "fallback" },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
completion = {
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
},
|
||||
list = {
|
||||
selection = {
|
||||
preselect = false,
|
||||
-- preselect = function(ctx)
|
||||
-- return vim.bo.filetype ~= "markdown"
|
||||
-- end,
|
||||
},
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 0,
|
||||
window = {
|
||||
border = window.border,
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
auto_show = true,
|
||||
draw = {
|
||||
columns = {
|
||||
{ "label", "label_description", gap = 1 },
|
||||
{ "kind", "source_name", gap = 1 },
|
||||
},
|
||||
components = {
|
||||
source_name = {
|
||||
text = function(ctx)
|
||||
if ctx.source_id ~= "snippets" then
|
||||
return "[" .. ctx.source_name .. "]"
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
border = window.border,
|
||||
},
|
||||
},
|
||||
|
||||
signature = {
|
||||
enabled = true,
|
||||
window = {
|
||||
border = window.border,
|
||||
},
|
||||
trigger = {
|
||||
show_on_accept = true,
|
||||
show_on_insert = true,
|
||||
},
|
||||
},
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = {
|
||||
"lazydev",
|
||||
"lsp",
|
||||
"path",
|
||||
"snippets",
|
||||
"buffer",
|
||||
},
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = "LazyDev",
|
||||
module = "lazydev.integrations.blink",
|
||||
-- make lazydev completions top priority (see `:h blink.cmp`)
|
||||
score_offset = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||
--
|
||||
-- See the fuzzy documentation for more information
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
},
|
||||
opts_extend = { "sources.default" },
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
-- https://github.com/hrsh7th/nvim-cmp
|
||||
return {
|
||||
{
|
||||
-- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind-nvim",
|
||||
|
||||
-- Snippets
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
local border = require("symbols.window").border
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = "menu,menuone,noinsert" },
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({
|
||||
border = border,
|
||||
winhighlight = "CursorLine:CmpSelection",
|
||||
}),
|
||||
documentation = cmp.config.window.bordered({ border = border }),
|
||||
},
|
||||
-- Include the source of the cmp entry
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "text",
|
||||
menu = {
|
||||
nvim_lsp = "LSP",
|
||||
luasnip = "LuaSnip",
|
||||
path = "Path",
|
||||
},
|
||||
}),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
select = true,
|
||||
}),
|
||||
["<Esc>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.abort()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "lazydev", group_index = 0 },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = "make install_jsregexp",
|
||||
cond = function()
|
||||
return vim.fn.executable("make") == 1
|
||||
end,
|
||||
config = function()
|
||||
require("luasnip").config.setup()
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
dependencies = {
|
||||
-- "rafamadriz/friendly-snippets",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
-- https://github.com/ray-x/lsp_signature.nvim
|
||||
return {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
opts = {
|
||||
hint_enable = false,
|
||||
handler_opts = {
|
||||
border = require("symbols.window").border,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -27,11 +27,13 @@ return {
|
||||
TelescopeMatching = { fg = palette.bright_aqua, bold = true },
|
||||
TelescopeSelection = { fg = palette.bright_blue },
|
||||
TelescopeSelectionCaret = { link = "TelescopeSelection" },
|
||||
CmpItemAbbrMatch = { fg = palette.bright_aqua, bold = true },
|
||||
CmpItemAbbrMatchFuzzy = { link = "CmpItemAbbrMatch" },
|
||||
CmpItemMenu = { fg = palette.dark2 },
|
||||
CmpItemKindFunction = { fg = palette.bright_red },
|
||||
CmpSelection = { fg = palette.dark0, bg = palette.bright_blue },
|
||||
BlinkCmpMenu = { fg = palette.dark2 },
|
||||
BlinkCmpMenuBorder = { fg = palette.dark4 },
|
||||
BlinkCmpDocBorder = { fg = palette.dark4 },
|
||||
BlinkCmpDocSeparator = { fg = palette.dark4 },
|
||||
BlinkCmpSignatureHelpBorder = { fg = palette.dark4 },
|
||||
BlinkCmpKindFunction = { fg = palette.bright_red },
|
||||
BlinkCmpMenuSelection = { fg = palette.dark0, bg = palette.bright_blue },
|
||||
LspReferenceText = { bg = palette.dark1 },
|
||||
LspReferenceRead = { link = "LspReferenceText" },
|
||||
LspReferenceWrite = { link = "LspReferenceText" },
|
||||
|
||||
Reference in New Issue
Block a user