增加ssh下载

This commit is contained in:
newbie 2024-02-01 11:57:48 +08:00
parent 04d2ed31d8
commit a077ec48c2
3 changed files with 15 additions and 2 deletions

View File

@ -30,7 +30,13 @@ if G.g.vscode then
require('vscode') require('vscode')
else else
require("options") require("options")
local clone_prefix = G.use_ssh and "git@github.com:%s.git" or "https://github.com/%s.git"
require("lazy").setup( require("lazy").setup(
require('plugs'), { lockfile = G.fn.stdpath("data") .. "/lazy/lazy-lock.json" } require('plugs'), {
lockfile = G.fn.stdpath("data") .. "/lazy/lazy-lock.json",
git = {
url_format = clone_prefix,
}
}
) )
end end

View File

@ -1,5 +1,7 @@
local G = {} local G = {}
G.use_ssh = true
G.g = vim.g G.g = vim.g
G.b = vim.b G.b = vim.b
G.o = vim.o G.o = vim.o

View File

@ -273,10 +273,15 @@ return {
} }
} }
} }
} }
require 'nvim-treesitter.configs'.setup(treesitter_opt) require 'nvim-treesitter.configs'.setup(treesitter_opt)
require 'nvim-treesitter.install'.prefer_git = true require 'nvim-treesitter.install'.prefer_git = true
if G.use_ssh then
local parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
for _, p in pairs(parsers) do
p.install_info.url = p.install_info.url:gsub("https://github/com/", "git@github.com:")
end
end
end end
}, },
}, },