deleted blink.lua but completed the completion.lua

This commit is contained in:
liph
2026-02-06 10:08:00 +01:00
parent b2194f79dd
commit 7b590ef2ec
7 changed files with 253 additions and 97 deletions

View File

@@ -6,9 +6,9 @@ include current-theme.conf
shell zsh --login
font_family JetBrainsMono Nerd Font
bold_font JetBrainsMono Nerd Font Bold
italic_font JetBrainsMono Nerd Font Italic
bold_italic_font JetBrainsMono Nerd Font Bold Italic
bold_font auto
italic_font auto
bold_italic_font auto
font_size 12

View File

@@ -3,7 +3,6 @@
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"R.nvim": { "branch": "main", "commit": "80268b5a66ad48e308513cb0ebccc16d5e1e7d5a" },
"barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
"blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" },
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
@@ -11,6 +10,7 @@
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp-r": { "branch": "main", "commit": "70bfe8f4c062acc10266e24825439c009a0b1b89" },
"cmp-tabnine": { "branch": "main", "commit": "c0167cdc86c15e782c5461ee62aebee89231c2ed" },
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
@@ -25,7 +25,7 @@
"gruvbox-mat": { "branch": "master", "commit": "790afe9dd085aa04eccd1da3626c5fa05c620e53" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"luvit-meta": { "branch": "main", "commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682" },

View File

@@ -0,0 +1,45 @@
-- ~/.config/nvim/lua/plugins/blink.lua
return {
"saghen/blink.cmp",
version = "1.*",
build = "cargo build --release",
lazy = false,
dependencies = {
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
},
opts = {
fuzzy = { implementation = "prefer_rust" },
sources = {
min_keyword_length = 2,
default = { "lsp", "snippets", "buffer", "path", "lua" },
per_filetype = {
lua = { default = { "lazydev", "lsp", "snippets", "buffer", "path" } },
},
},
completion = {
accept = { auto_brackets = { enabled = true } },
trigger = { show_on_trigger_character = true },
list = {
selection = {
preselect = function(ctx) return ctx.mode ~= "cmdline" end,
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 100,
},
},
signature = { enabled = true, window = { border = "rounded" } },
cmdline = { enabled = false },
},
config = function(_, opts)
require("blink.cmp").setup(opts)
end,
}

View File

@@ -0,0 +1,60 @@
-- ~/.config/nvim/lua/plugins/blink.lua
return {
"saghen/blink.cmp",
version = "1.*",
build = "cargo build --release",
lazy = false,
dependencies = {
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
},
opts = {
fuzzy = { implementation = "prefer_rust" },
sources = {
min_keyword_length = 1,
default = { "lsp", "snippets", "buffer", "path" },
providers = {
lsp = { name = "LSP", opts = { max_items = 200, score_offset = 0 } },
buffer = { name = "Buffer", opts = { max_items = 100 } },
},
per_filetype = {
lua = { default = { "lazydev", "lsp", "snippets", "buffer", "path" } },
},
},
completion = {
accept = { auto_brackets = { enabled = true } },
trigger = { show_on_trigger_character = true },
list = { selection = "auto_insert" },
documentation = { auto_show = true, auto_show_delay_ms = 200 },
ghost_text = { enabled = true },
},
signature = { enabled = true, window = { border = "rounded" } },
cmdline = { enabled = false },
-- Tab cycles through items and accepts
keymap = {
preset = "enter",
["<Tab>"] = {
"select_next",
"accept",
"snippet_forward",
"fallback",
},
["<S-Tab>"] = {
"select_prev",
"snippet_backward",
"fallback",
},
["<CR>"] = { "accept", "fallback" },
},
},
config = function(_, opts)
require("blink.cmp").setup(opts)
end,
}

View File

@@ -0,0 +1,61 @@
-- completions.lua: Provides intelligent code completion via LSP or snippet engines.
return {
{
"hrsh7th/cmp-nvim-lsp",
},
{
"hrsh7th/cmp-cmdline", -- Command line completion
},
{
"hrsh7th/cmp-nvim-lua", -- Better Neovim Lua API completion
},
{
"hrsh7th/cmp-path", -- ADD THIS: Path completion source
},
{
"hrsh7th/cmp-buffer", -- ADD THIS: Buffer completion source
},
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
dependencies = {
"rafamadriz/friendly-snippets", -- Pre-made snippets
},
},
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
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 = true }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lua" }, -- ADD THIS: For nvim lua API completion
}, {
{ name = "buffer" },
{ name = "path" },
{ name = "cmp_tabnine" }, -- ai powered suggestions
}),
})
end,
},
}

View File

@@ -1,60 +0,0 @@
-- ~/.config/nvim/lua/plugins/blink.lua
return {
"saghen/blink.cmp", -- ✅ CORRECT: Use the shorthand plugin name for lazy.nvim.
version = "v1.*",
build = "cargo build --release", -- Builds the optional high-performance Rust fuzzy matcher[citation:7].
lazy = false, -- Must load early for LSP capabilities.
dependencies = {
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
},
opts = {
fuzzy = { implementation = "prefer_rust" }, -- Silences missing binary warning, uses pre-built if available.
---------------------------------------------------------------------------
-- SOURCES - CRITICAL FIX HERE
---------------------------------------------------------------------------
sources = {
min_keyword_length = 2,
default = { "lsp", "snippets", "buffer", "path", "cmp_tabnine" }, -- ✅ Use lowercase provider IDs.
providers = {
lsp = { name = "LSP", module = "blink.cmp.sources.lsp" }, -- ✅ "lsp"
snippets = { name = "Snippets", module = "blink.cmp.sources.snippets" }, -- ✅ "snippets" for luasnip
buffer = { name = "Buffer", module = "blink.cmp.sources.buffer" },
path = { name = "Path", module = "blink.cmp.sources.path" },
cmp_tabnine = {
name = "TabNine",
module = "blink.compat.source", -- ✅ Requires the optional `blink.compat` plugin.
},
},
per_filetype = {
lua = { default = { "lazydev", "lsp", "snippets", "buffer", "path" } },
},
},
---------------------------------------------------------------------------
-- COMPLETION BEHAVIOR
---------------------------------------------------------------------------
completion = {
accept = { auto_brackets = { enabled = true } },
trigger = { show_on_trigger_character = true },
list = {
selection = {
preselect = function(ctx)
return ctx.mode ~= "cmdline"
end,
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 100,
},
},
signature = { enabled = true, window = { border = "rounded" } },
cmdline = { enabled = false },
},
config = function(_, opts)
require("blink.cmp").setup(opts)
end,
}

View File

@@ -1,38 +1,77 @@
-- completions.lua: Provides intelligent code completion via LSP or snippet engines.
-- completion.lua (nvim-cmp + LuaSnip + TabNine no unzip required)
return {
{
"hrsh7th/cmp-nvim-lsp",
},
{
"hrsh7th/cmp-cmdline", -- Command line completion
},
{
"hrsh7th/cmp-nvim-lua", -- Better Neovim Lua API completion
},
{
"hrsh7th/cmp-path", -- ADD THIS: Path completion source
},
{
"hrsh7th/cmp-buffer", -- ADD THIS: Buffer completion source
},
------------------------------------------------------------------
-- 1. Snippet engine & pre-made snippets
------------------------------------------------------------------
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
dependencies = {
"rafamadriz/friendly-snippets", -- Pre-made snippets
},
dependencies = { "rafamadriz/friendly-snippets" }
},
------------------------------------------------------------------
-- 2. Core completion engine + all standard sources
------------------------------------------------------------------
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
------------------------------------------------------------------
-- 3. TabNine (AI) source install without unzip
------------------------------------------------------------------
{
"tzachar/cmp-tabnine",
-- download & unpack with curl + tar (gzip) only
build = function()
local api = vim.fn
local version = api.systemlist('curl -sS https://update.tabnine.com/bundles/version')[1]
local platform = (function()
local os = api.substitute(api.system('uname -s'), '\n', '', '')
local arch = api.substitute(api.system('uname -m'), '\n', '', '')
return arch ..
'-unknown-' .. (os == 'Linux' and 'linux-musl' or os == 'Darwin' and 'apple-darwin' or 'linux-musl')
end)()
local root = api.stdpath('data') .. '/lazy/cmp-tabnine'
local target = root .. '/binaries/' .. version .. '/' .. platform
api.mkdir(target, 'p')
api.system(string.format(
'curl -L https://update.tabnine.com/bundles/%s/%s/TabNine.zip | gzip -dc | tar -C %s -xf -',
version, platform, target))
api.system('chmod +x ' .. target .. '/TabNine')
vim.g.cmp_tabnine_binary = target .. '/TabNine'
end,
opts = {
max_lines = 1000,
max_num_results = 20,
sort = true,
run_on_every_keystroke = true,
show_prediction_strength = false,
},
config = function(_, opts)
require('cmp_tabnine.config'):setup(opts)
end,
},
},
------------------------------------------------------------------
-- 4. nvim-cmp setup
------------------------------------------------------------------
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
local cmp = require('cmp')
require('luasnip.loaders.from_vscode').lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
require('luasnip').lsp_expand(args.body)
end,
},
window = {
@@ -40,22 +79,33 @@ return {
documentation = cmp.config.window.bordered(),
},
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 = true }),
['<Tab>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-e>'] = cmp.mapping.abort(),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lua" }, -- ADD THIS: For nvim lua API completion
{ name = 'cmp_tabnine', priority = 100 },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'nvim_lua' },
}, {
{ name = "buffer" },
{ name = "path" },
{ name = "cmp_tabnine" }, -- ai powered suggestions
{ name = 'buffer' },
{ name = 'path' },
}),
formatting = {
format = function(entry, item)
if entry.source.name == 'cmp_tabnine' then item.menu = '' end
return item
end,
},
})
-- cmd-line completion
cmp.setup.cmdline({ '/', '?' }, { sources = { { name = 'buffer' } } })
cmp.setup.cmdline(':', { sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }) })
end,
},
}