InsisVim icon indicating copy to clipboard operation
InsisVim copied to clipboard

国内用户建议使用 ghproxy 加快插件安装速度

Open jonahfang opened this issue 2 years ago • 5 comments
trafficstars

例如:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://ghproxy.com/https://github.com/folke/lazy.nvim.git",
    "--branch=v10.4.1",
    lazypath,
  })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

require("lazy").setup({
	spec = {
	...
	},
    git = {
      url_format = "https://ghproxy.com/https://github.com/%s"
    },
	performance = {
		rtp = {
			-- disable some rtp plugins
			disabled_plugins = {
               "2html_plugin",
               "getscript",
               "getscriptPlugin",
               "gzip",
               "logipat",
               "netrw",
               "netrwPlugin",
               "netrwSettings",
               "netrwFileHandlers",
               "matchit",
               "tar",
               "tarPlugin",
               "rrhelper",
               "spellfile_plugin",
               "vimball",
               "vimballPlugin",
               "zip",
               "zipPlugin",
               "tutor",
               "rplugin",
               "synmenu",
               "optwin",
               "compiler",
               "bugreport",
               "ftplugin",
			},
		},
	},
})
-- EOF

jonahfang avatar Oct 07 '23 21:10 jonahfang

感觉没有全局网络环境使用 neovim 挺难的,即使下载了lazy.nvim,还有其他插件,lsp,treesitter语法高亮等等都要下载,用代理感觉不是很稳定。

nshen avatar Oct 17 '23 08:10 nshen

请仔细看我的上述配置,不是光解决lazy.nvim的下载,而是使用ghproxy.com后其他所有插件下载速度很快啊:

...
require("lazy").setup({
	spec = {
	...
	},
    git = {
      url_format = "https://ghproxy.com/https://github.com/%s"
    },
	...

jonahfang avatar Oct 17 '23 08:10 jonahfang

lsp的配置可以在lua/insis/lsp/init.luamason.setup里添加:

  github = {
    download_url_template = "https://ghproxy.com/https://github.com/%s/releases/download/%s/%s",
  },

copilot可以在lua/insis/basic.lua里的任意位置添加一行:

vim.g.copilot_proxy = "localhost:1234"

treesitter可以在lua/insis/plugins/treesitter.luapRequire("nvim-treesitter.install").prefer_git = true行下面添加:

  for _, config in pairs(require("nvim-treesitter.parsers").get_parser_configs()) do
    config.install_info.url = config.install_info.url:gsub("https://github.com/", "https://ghproxy.com/https://github.com/")
  end

s-leeq avatar Jan 26 '24 08:01 s-leeq

@s-leeq ghproxy 好像不好用了,我现在用 521github, 例如:

 git clone https://521github.com/jonahfang/cd-project.nvim.git

jonahfang avatar Jan 26 '24 08:01 jonahfang

@s-leeq ghproxy 好像不好用了,我现在用 521github, 例如:

 git clone https://521github.com/jonahfang/cd-project.nvim.git

不重要,反正就是类似修改就好了:)

s-leeq avatar Jan 26 '24 09:01 s-leeq