feat: replace nvim-cmp with blink-cmp
This commit is contained in:
parent
022abfffc5
commit
eeb8173a90
4 changed files with 43 additions and 128 deletions
28
neovim/blink-cmp.lua
Normal file
28
neovim/blink-cmp.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
require("copilot").setup({
|
||||||
|
copilot_model = "claude-4-sonnet"
|
||||||
|
})
|
||||||
|
|
||||||
|
require("blink-copilot").setup({})
|
||||||
|
|
||||||
|
require("blink-cmp").setup({
|
||||||
|
completion = {
|
||||||
|
documentation = { auto_show = true, auto_show_delay_ms = 500 },
|
||||||
|
ghost_text = { enabled = true },
|
||||||
|
},
|
||||||
|
keymap = {
|
||||||
|
preset = "default"
|
||||||
|
},
|
||||||
|
signature = { enabled = true },
|
||||||
|
sources = {
|
||||||
|
default = { "copilot", "lsp", "buffer", "path", "cmdline", "codecompanion" },
|
||||||
|
|
||||||
|
providers = {
|
||||||
|
copilot = {
|
||||||
|
name = "copilot",
|
||||||
|
module = "blink-copilot",
|
||||||
|
score_offset = 100,
|
||||||
|
async = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
|
@ -1,5 +1,9 @@
|
||||||
{ pkgs, theme, vimwikiPath, ... }:
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
theme,
|
||||||
|
vimwikiPath,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
programs = {
|
programs = {
|
||||||
neovim = {
|
neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -55,15 +59,8 @@
|
||||||
luasnip
|
luasnip
|
||||||
|
|
||||||
# auto-completion
|
# auto-completion
|
||||||
nvim-cmp
|
blink-cmp
|
||||||
cmp-nvim-lsp
|
blink-copilot
|
||||||
cmp-buffer
|
|
||||||
cmp-path
|
|
||||||
cmp-cmdline
|
|
||||||
cmp-nvim-lua
|
|
||||||
cmp_luasnip
|
|
||||||
cmp-calc
|
|
||||||
cmp-nvim-lsp-signature-help
|
|
||||||
|
|
||||||
# telescope
|
# telescope
|
||||||
telescope-nvim
|
telescope-nvim
|
||||||
|
@ -82,7 +79,6 @@
|
||||||
# Copilot
|
# Copilot
|
||||||
copilot-lua
|
copilot-lua
|
||||||
copilot-cmp
|
copilot-cmp
|
||||||
CopilotChat-nvim
|
|
||||||
codecompanion-nvim
|
codecompanion-nvim
|
||||||
|
|
||||||
# debugging
|
# debugging
|
||||||
|
@ -114,14 +110,14 @@
|
||||||
texlab
|
texlab
|
||||||
nixd
|
nixd
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
bitbake-language-server
|
|
||||||
pyright
|
pyright
|
||||||
|
|
||||||
(python3.withPackages (ps: with ps; [
|
(python3.withPackages (ps:
|
||||||
pep8
|
with ps; [
|
||||||
autopep8
|
pep8
|
||||||
python-lsp-server
|
autopep8
|
||||||
]))
|
python-lsp-server
|
||||||
|
]))
|
||||||
|
|
||||||
#clipboard
|
#clipboard
|
||||||
xclip
|
xclip
|
||||||
|
@ -150,7 +146,7 @@
|
||||||
require("local_indent-blankline")
|
require("local_indent-blankline")
|
||||||
require("local_gitsigns")
|
require("local_gitsigns")
|
||||||
require("local_luasnip")
|
require("local_luasnip")
|
||||||
require("local_nvim-cmp")
|
require("local_blink-cmp")
|
||||||
require("local_telescope")
|
require("local_telescope")
|
||||||
|
|
||||||
require("local_themes").setup("${theme}")
|
require("local_themes").setup("${theme}")
|
||||||
|
@ -168,17 +164,6 @@
|
||||||
|
|
||||||
require("local_firenvim")
|
require("local_firenvim")
|
||||||
|
|
||||||
require("CopilotChat").setup({
|
|
||||||
highlight_headers = false,
|
|
||||||
separator = "---",
|
|
||||||
error_header = "> [!ERROR] Error",
|
|
||||||
window = {
|
|
||||||
layout = "float",
|
|
||||||
width = 0.8,
|
|
||||||
height = 0.8,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require("local_codecompanion")
|
require("local_codecompanion")
|
||||||
|
|
||||||
require("diffview").setup({
|
require("diffview").setup({
|
||||||
|
@ -212,7 +197,7 @@
|
||||||
home.file.".config/nvim/lua/local_indent-blankline.lua".source = ./indent-blankline.lua;
|
home.file.".config/nvim/lua/local_indent-blankline.lua".source = ./indent-blankline.lua;
|
||||||
home.file.".config/nvim/lua/local_gitsigns.lua".source = ./gitsigns.lua;
|
home.file.".config/nvim/lua/local_gitsigns.lua".source = ./gitsigns.lua;
|
||||||
home.file.".config/nvim/lua/local_luasnip.lua".source = ./luasnip.lua;
|
home.file.".config/nvim/lua/local_luasnip.lua".source = ./luasnip.lua;
|
||||||
home.file.".config/nvim/lua/local_nvim-cmp.lua".source = ./nvim-cmp.lua;
|
home.file.".config/nvim/lua/local_blink-cmp.lua".source = ./blink-cmp.lua;
|
||||||
home.file.".config/nvim/lua/local_telescope.lua".source = ./telescope.lua;
|
home.file.".config/nvim/lua/local_telescope.lua".source = ./telescope.lua;
|
||||||
|
|
||||||
home.file.".config/nvim/lua/local_themes.lua".source = ./themes.lua;
|
home.file.".config/nvim/lua/local_themes.lua".source = ./themes.lua;
|
||||||
|
|
|
@ -50,8 +50,6 @@ lsp_status.register_progress()
|
||||||
|
|
||||||
require('lazydev').setup()
|
require('lazydev').setup()
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_status.capabilities)
|
|
||||||
|
|
||||||
local servers = {
|
local servers = {
|
||||||
["bashls"] = {},
|
["bashls"] = {},
|
||||||
["bitbake_language_server"] = {},
|
["bitbake_language_server"] = {},
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
local has_words_before = function()
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and
|
|
||||||
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
|
|
||||||
col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local copilot_lua = require("copilot")
|
|
||||||
local copilot_cmp = require("copilot_cmp")
|
|
||||||
local lspkind = require("lspkind")
|
|
||||||
|
|
||||||
copilot_lua.setup({
|
|
||||||
copilot_model = "claude-3.5-sonnet",
|
|
||||||
})
|
|
||||||
copilot_cmp.setup({})
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end
|
|
||||||
},
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "copilot" },
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "nvim_lsp_signature_help" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
{ name = "path" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "nvim-lua" },
|
|
||||||
{ name = "calc" },
|
|
||||||
}),
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
|
||||||
["<C-Space>"] = cmp.mapping.complete({}),
|
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
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" }),
|
|
||||||
}),
|
|
||||||
experimental = { ghost_text = true },
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
formatting = {
|
|
||||||
format = lspkind.cmp_format({
|
|
||||||
mode = "symbol",
|
|
||||||
maxwidth = {
|
|
||||||
menu = 50,
|
|
||||||
abbr = 50,
|
|
||||||
},
|
|
||||||
ellipsis_char = "...",
|
|
||||||
show_labelDetails = true,
|
|
||||||
symbol_map = {
|
|
||||||
Copilot = "",
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- `/` cmdline setup.
|
|
||||||
cmp.setup.cmdline("/", {
|
|
||||||
sources = cmp.config.sources(
|
|
||||||
{ name = "buffer" }
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
-- `:` cmdline setup.
|
|
||||||
cmp.setup.cmdline(":", {
|
|
||||||
sources = cmp.config.sources(
|
|
||||||
{ name = "path" },
|
|
||||||
{ name = "cmdline" }
|
|
||||||
)
|
|
||||||
})
|
|
Loading…
Add table
Add a link
Reference in a new issue