Skip to content

Instantly share code, notes, and snippets.

@kmrk
Last active July 13, 2023 06:48
Show Gist options
  • Save kmrk/383acc256546ee4977b6f39e797f7f5b to your computer and use it in GitHub Desktop.
Save kmrk/383acc256546ee4977b6f39e797f7f5b to your computer and use it in GitHub Desktop.
add socks5 proxy to mason.nvim on Windows(iwr)
PS ~\AppData\Local\nvim-data\lazy\mason.nvim> git diff
diff --git a/lua/mason-core/fetch.lua b/lua/mason-core/fetch.lua
index c8a8591..c9eb559 100644
--- a/lua/mason-core/fetch.lua
+++ b/lua/mason-core/fetch.lua
@@ -49,7 +49,7 @@ local function fetch(url, opts)
if opts.out_file then
platform_specific = function()
return powershell.command(
- ([[iwr %s -TimeoutSec %s -UseBasicParsing -Method %q -Uri %q %s -OutFile %q;]]):format(
+ ([[iwr %s -TimeoutSec %s -Proxy "socks5://localhost:1080" -UseBasicParsing -Method %q -Uri %q %s -OutFile %q;]]):format(
headers,
TIMEOUT_SECONDS,
opts.method,
@@ -62,7 +62,7 @@ local function fetch(url, opts)
else
platform_specific = function()
return powershell.command(
- ([[Write-Output (iwr %s -TimeoutSec %s -Method %q -UseBasicParsing %s -Uri %q).Content;]]):format(
+ ([[Write-Output (iwr %s -TimeoutSec %s -Proxy "socks5://localhost:1080" -Method %q -UseBasicParsing %s -Uri %q).Content;]]):format(
headers,
TIMEOUT_SECONDS,
opts.method,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment