Skip to content

Alternative Starter For Termux #150

Open

Description

@Beapoe

cat << 'EOF' > /data/data/com.termux/files/home/bootstrap_lazy.lua
-- 定义路径(适配 Termux 环境)
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

print("检查 lazy.nvim 路径: " .. lazypath)

-- 检查是否已存在
if not (vim.uv or vim.loop).fs_stat(lazypath) then
print("未找到 lazy.nvim,正在克隆仓库...")
-- 执行 git clone
local clone_cmd = {"git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath}
local result = vim.fn.system(clone_cmd)
if vim.v.shell_error ~= 0 then
vim.api.nvim_err_writeln("Git 克隆失败!错误信息:\n" .. result)
os.exit(1)
end
print("✅ lazy.nvim 克隆成功!")
else
print("✅ lazy.nvim 已存在。")
end

-- 将 lazy.nvim 添加到运行时路径的最前面
vim.opt.rtp:prepend(lazypath)
print("✅ 已将 lazy.nvim 添加到运行时路径。")

-- 尝试加载 lazy 模块并设置(这是关键验证)
print("正在尝试加载 lazy 模块...")
local ok, lazy = pcall(require, "lazy")
if not ok then
vim.api.nvim_err_writeln("❌ 加载 lazy 模块失败: " .. lazy)
os.exit(1)
end
print("✅ lazy 模块加载成功。")

-- 这里我们暂时只设置一个空插件表,确保管理器能工作
-- 您的完整 LazyVim 配置稍后会由 ~/.config/nvim/init.lua 加载
lazy.setup({})
print("✅ lazy.nvim 引导安装和验证完成!")
print("现在您可以正常使用命令 ‘nvim‘ 启动 LazyVim 了。")
EOF

nvim -l /data/data/com.termux/files/home/bootstrap_lazy.lua --headless 2>&1

Activity

  1. Beapoe commented on Feb 9, 2026

    @Beapoe
    Author

    Copy all the code and paste it into terminal.
    Then run it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions