适配我的termux、架构判断提取为全局变量、重写ufo使用lsp折叠相关配置

This commit is contained in:
tiny 2026-04-26 01:09:44 +00:00
parent 08a226d9ee
commit ca576a6090
7 changed files with 33 additions and 37 deletions

View file

@ -1,12 +1,8 @@
-- === LSP 核心配置 (Lspconfig + Mason) ===
if vim.g.vscode then return end
-- 环境探测:判断 CPU 架构,决定安装哪些 LSP
local arch = jit and jit.arch or ""
local is_arm = arch:match("arm") or arch:match("aarch64")
local servers = { "lua_ls", "rust_analyzer", "pylsp", "denols", }
if not is_arm then
if not IS_ARM then
vim.list_extend(servers, { "marksman", "svelte", "cssls", "html" })
end

View file

@ -13,11 +13,16 @@ vim.api.nvim_create_user_command("PeekToggle", function()
local peek = require("peek")
if not peek.is_open() and vim.bo[vim.api.nvim_get_current_buf()].filetype == 'markdown' then
PackUtils.load(P, function()
local app = { "chromium", "--app=http://localhost:9000/?theme=dark", "--incognito" }
if IS_ARM then
app = { "chromium", "--no-sandbox", "--app=http://localhost:9000/?theme=dark", "--incognito", "--test-type",
"--force-device-scale-factor=1.75" }
end
require("peek").setup({
port = 9000,
-- app = { "zen", "-private-window" },
-- app = { "firefox-esr", "-private-window" },
app = { "chromium", "--app=http://localhost:9000/?theme=dark", "--incognito" },
app = app
})
end)
peek.open()

View file

@ -14,7 +14,7 @@ local ensure_installed = {
"python",
"lua",
"markdown",
"bash",
"sh",
"java",
}

View file

@ -20,16 +20,14 @@ vim.api.nvim_create_autocmd({
vim.schedule(function()
PackUtils.load(P, function()
-- Option 2: nvim lsp as LSP client
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'}
for _, ls in ipairs(language_servers) do
require("lspconfig")[ls].setup({
capabilities = capabilities,
})
local orig_make_client_capabilities = vim.lsp.protocol.make_client_capabilities
vim.lsp.protocol.make_client_capabilities = function()
local caps = orig_make_client_capabilities()
caps.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
return caps
end
require("ufo").setup({})
-- Option 3: treesitter as a main provider instead