Files
dotfiles/nvim/lua/plugins/blink.lua
Li Tang 6fd5d96043 refactor(nvim): 完整重写配置,支持 Go/Rust/Python/TypeScript 开发
- 架构重构:新增 plugins/lang/ 子目录,按语言拆分配置
- 补全引擎:nvim-cmp → blink.cmp + LuaSnip
- 文件浏览:新增 neo-tree(<Space>e)
- 语言支持:
  - Go: ray-x/go.nvim + dap-go + neotest-go
  - Rust: rustaceanvim + crates.nvim
  - Python: venv-selector + dap-python + neotest-python
  - TypeScript: typescript-tools.nvim(替换 ts_ls)
- LSP: lazydev + mason + mason-lspconfig + fidget + inc-rename
- 格式化: conform.nvim(lsp_format fallback,保存时自动格式化)
- Lint: nvim-lint(selene 替换 luacheck,Mason 可直接安装)
- UI: snacks.nvim(dashboard+notifier+picker)+ noice + lualine + bufferline
- 编辑增强: mini.ai + mini.surround + grug-far + flash + ufo + trouble v3
- 删除废弃文件: cmp/coding/null-ls/mason/lspconfig/go/python 等旧文件
- 修复: Neovim 0.12 treesitter query 校验报错(noice routes 过滤)
- 新增: NVIM_GUIDE.md 快捷键使用手册

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-07 16:55:07 +08:00

100 lines
2.7 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- blink.lua - blink.cmp 补全引擎(替换 nvim-cmp
return {
{
"saghen/blink.cmp",
version = "*",
event = "InsertEnter",
dependencies = {
"rafamadriz/friendly-snippets",
{ "L3MON4D3/LuaSnip", version = "v2.*" },
},
opts = {
keymap = {
preset = "default",
["<C-Space>"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide" },
["<CR>"] = { "accept", "fallback" },
["<Tab>"] = { "snippet_forward", "fallback" },
["<S-Tab>"] = { "snippet_backward", "fallback" },
["<C-n>"] = { "select_next", "fallback" },
["<C-p>"] = { "select_prev", "fallback" },
["<C-b>"] = { "scroll_documentation_up", "fallback" },
["<C-f>"] = { "scroll_documentation_down", "fallback" },
},
appearance = {
nerd_font_variant = "mono",
},
snippets = {
expand = function(snippet)
require("luasnip").lsp_expand(snippet)
end,
active = function(filter)
if filter and filter.direction then
return require("luasnip").jumpable(filter.direction)
end
return require("luasnip").in_snippet()
end,
jump = function(direction)
require("luasnip").jump(direction)
end,
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {
lsp = { score_offset = 100 },
path = { score_offset = 50 },
snippets = { score_offset = 40 },
buffer = { score_offset = 10 },
},
},
completion = {
accept = { auto_brackets = { enabled = true } },
menu = {
border = "rounded",
draw = {
treesitter = { "lsp" },
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind" },
},
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 200,
window = { border = "rounded" },
},
ghost_text = { enabled = true },
},
signature = {
enabled = true,
window = { border = "rounded" },
},
},
config = function(_, opts)
-- LuaSnip 加载 vscode 风格的代码片段
require("luasnip.loaders.from_vscode").lazy_load()
require("blink.cmp").setup(opts)
end,
},
-- LuaSnip 代码片段引擎
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
dependencies = { "rafamadriz/friendly-snippets" },
opts = {
history = true,
delete_check_events = "TextChanged",
},
},
}