mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2025-02-22 17:48:00 +00:00
[neovim] Replace lsp-cmp by blink
This commit is contained in:
parent
b40fa30e54
commit
302db332f9
@ -1,7 +1,7 @@
|
|||||||
-- Highlight Yanked Text
|
-- Highlight Yanked Text
|
||||||
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank({ higroup = "Visual", timeout = 250 })
|
(vim.hl or vim.highlight).on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -140,12 +140,10 @@ require("lazy").setup({
|
|||||||
|
|
||||||
-- cmp plugins
|
-- cmp plugins
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"saghen/blink.cmp",
|
||||||
event = "InsertEnter",
|
version = "*",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-buffer",
|
"fang2hou/blink-copilot",
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -282,7 +280,6 @@ require("lazy").setup({
|
|||||||
cmd = "Copilot",
|
cmd = "Copilot",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
},
|
},
|
||||||
{ "zbirenbaum/copilot-cmp" },
|
|
||||||
{ "AndreM222/copilot-lualine" },
|
{ "AndreM222/copilot-lualine" },
|
||||||
{
|
{
|
||||||
"copilotc-nvim/copilotchat.nvim",
|
"copilotc-nvim/copilotchat.nvim",
|
||||||
|
@ -16,6 +16,3 @@ require("nvim-autopairs").setup({
|
|||||||
highlight_grey = "LineNr",
|
highlight_grey = "LineNr",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
|
||||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
|
|
||||||
|
45
.config/nvim/lua/plugins/blink.lua
Normal file
45
.config/nvim/lua/plugins/blink.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
require("blink.cmp").setup({
|
||||||
|
appearance = {
|
||||||
|
use_nvim_cmp_as_default = false,
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
accept = {
|
||||||
|
auto_brackets = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
menu = {
|
||||||
|
border = "single",
|
||||||
|
draw = {
|
||||||
|
treesitter = { "lsp" },
|
||||||
|
columns = {
|
||||||
|
{ "label", "label_description", gap = 1 },
|
||||||
|
{ "kind_icon", "kind", gap = 1 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
signature = { window = { border = "single" } },
|
||||||
|
sources = {
|
||||||
|
default = { "lsp", "path", "buffer", "copilot" },
|
||||||
|
providers = {
|
||||||
|
copilot = {
|
||||||
|
name = "copilot",
|
||||||
|
module = "blink-copilot",
|
||||||
|
score_offset = 100,
|
||||||
|
async = true,
|
||||||
|
opts = {
|
||||||
|
kind = "IA",
|
||||||
|
max_completions = 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
keymap = {
|
||||||
|
preset = "enter",
|
||||||
|
["<C-q>"] = { "hide", "fallback" },
|
||||||
|
["<S-Tab>"] = { "select_prev", "fallback" },
|
||||||
|
["<Tab>"] = { "select_next", "fallback" },
|
||||||
|
},
|
||||||
|
})
|
@ -1,102 +0,0 @@
|
|||||||
local cmp = require("cmp")
|
|
||||||
|
|
||||||
local kind_icons = {
|
|
||||||
Array = " ",
|
|
||||||
Boolean = " ",
|
|
||||||
Class = " ",
|
|
||||||
Codeium = " ",
|
|
||||||
Color = " ",
|
|
||||||
Constant = " ",
|
|
||||||
Constructor = " ",
|
|
||||||
Copilot = " ",
|
|
||||||
Enum = " ",
|
|
||||||
EnumMember = " ",
|
|
||||||
Event = " ",
|
|
||||||
Field = " ",
|
|
||||||
File = " ",
|
|
||||||
Folder = " ",
|
|
||||||
Function = " ",
|
|
||||||
Interface = " ",
|
|
||||||
Key = " ",
|
|
||||||
Keyword = " ",
|
|
||||||
Method = " ",
|
|
||||||
Module = " ",
|
|
||||||
Namespace = " ",
|
|
||||||
Null = " ",
|
|
||||||
Number = " ",
|
|
||||||
Object = " ",
|
|
||||||
Operator = " ",
|
|
||||||
Package = " ",
|
|
||||||
Property = " ",
|
|
||||||
Reference = " ",
|
|
||||||
String = " ",
|
|
||||||
Struct = " ",
|
|
||||||
Text = " ",
|
|
||||||
TypeParameter = " ",
|
|
||||||
Unit = " ",
|
|
||||||
Value = " ",
|
|
||||||
Variable = " ",
|
|
||||||
}
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
mapping = {
|
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
|
||||||
["<C-k>"] = cmp.mapping.scroll_docs(-1),
|
|
||||||
["<C-j>"] = cmp.mapping.scroll_docs(1),
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
["<C-q>"] = cmp.mapping.close(),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({
|
|
||||||
behavior = cmp.ConfirmBehavior.Insert,
|
|
||||||
select = true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
},
|
|
||||||
|
|
||||||
formatting = {
|
|
||||||
fields = { "kind", "abbr", "menu" },
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
vim_item.kind = kind_icons[vim_item.kind]
|
|
||||||
vim_item.menu = ({
|
|
||||||
nvim_lsp = "[lsp]",
|
|
||||||
buffer = "[local]",
|
|
||||||
copilot = "[AI]",
|
|
||||||
path = "",
|
|
||||||
emoji = "",
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "path" },
|
|
||||||
{ name = "copilot" },
|
|
||||||
},
|
|
||||||
confirm_opts = {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = false,
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
experimental = {
|
|
||||||
ghost_text = { enabled = true },
|
|
||||||
},
|
|
||||||
})
|
|
@ -26,7 +26,6 @@ local prompts = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require("copilot_cmp").setup()
|
|
||||||
require("CopilotChat").setup({
|
require("CopilotChat").setup({
|
||||||
highlight_headers = false,
|
highlight_headers = false,
|
||||||
separator = "———",
|
separator = "———",
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
require("illuminate").configure({
|
require("illuminate").configure({
|
||||||
delay = 200,
|
delay = 200,
|
||||||
filetypes_denylist = {
|
filetypes_denylist = {
|
||||||
"neo-tree",
|
|
||||||
"packer",
|
|
||||||
"Trouble",
|
|
||||||
"TelescopePrompt",
|
"TelescopePrompt",
|
||||||
|
"Trouble",
|
||||||
|
"avante",
|
||||||
"lspsagafinder",
|
"lspsagafinder",
|
||||||
"mason",
|
"mason",
|
||||||
|
"neo-tree",
|
||||||
|
"packer",
|
||||||
"starter",
|
"starter",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
require("plugins.cmp")
|
require("plugins.blink")
|
||||||
require("plugins.copilot")
|
require("plugins.copilot")
|
||||||
require("plugins.telescope")
|
require("plugins.telescope")
|
||||||
require("plugins.starter")
|
require("plugins.starter")
|
||||||
|
@ -1,8 +1,48 @@
|
|||||||
require("plugins.lsp.mason")
|
require("plugins.lsp.mason")
|
||||||
require("plugins.lsp.handlers").setup()
|
|
||||||
require("plugins.lsp.none-ls")
|
require("plugins.lsp.none-ls")
|
||||||
require("plugins.lsp.conform")
|
require("plugins.lsp.conform")
|
||||||
require("plugins.lsp.lsp-saga")
|
require("plugins.lsp.lsp-saga")
|
||||||
|
|
||||||
local win = require("lspconfig.ui.windows")
|
local win = require("lspconfig.ui.windows")
|
||||||
win.default_options.border = "rounded"
|
win.default_options.border = "rounded"
|
||||||
|
|
||||||
|
local signs = {
|
||||||
|
{ name = "DiagnosticSignError", text = "" },
|
||||||
|
{ name = "DiagnosticSignWarn", text = "" },
|
||||||
|
{ name = "DiagnosticSignHint", text = "" },
|
||||||
|
{ name = "DiagnosticSignInfo", text = "" },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, sign in ipairs(signs) do
|
||||||
|
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
virtual_text = false,
|
||||||
|
signs = {
|
||||||
|
active = signs,
|
||||||
|
},
|
||||||
|
update_in_insert = true,
|
||||||
|
underline = true,
|
||||||
|
severity_sort = true,
|
||||||
|
float = {
|
||||||
|
focusable = true,
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded",
|
||||||
|
source = "always",
|
||||||
|
header = "",
|
||||||
|
prefix = "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.diagnostic.config(config)
|
||||||
|
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||||
|
border = "rounded",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||||
|
border = "rounded",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.diagnostic.config(config)
|
||||||
|
@ -38,8 +38,7 @@ local lspconfig = require("lspconfig")
|
|||||||
for _, server in pairs(servers) do
|
for _, server in pairs(servers) do
|
||||||
if server ~= "yamlls" then
|
if server ~= "yamlls" then
|
||||||
local opts = {
|
local opts = {
|
||||||
on_attach = require("plugins.lsp.handlers").on_attach,
|
capabilities = require("blink.cmp").get_lsp_capabilities(),
|
||||||
capabilities = require("plugins.lsp.handlers").capabilities,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server = vim.split(server, "@")[1]
|
server = vim.split(server, "@")[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user