A zsh plugin for managing shell environment proxy settings.
- Easy proxy configuration through interactive prompts
- Support for both HTTP and SOCKS5 proxies
- Automatic proxy activation on shell startup (optional)
- Automatic proxy availability check when auto-start is enabled
- Environment variable management for system-wide proxy settings
- No-proxy list for excluding local addresses
Using Oh My Zsh
- Clone this repository into
$ZSH_CUSTOM/plugins
(by default~/.oh-my-zsh/custom/plugins
)
git clone https://github.com/xooooooooox/zsh-proxy ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-proxy
- Add the plugin to the list of plugins in your
.zshrc
file:
plugins=(... zsh-proxy)
Using zinit
Add one of the following to your .zshrc
file:
From GitCode:
zinit snippet 'https://raw.gitcode.com/xooooooooox/zsh-proxy/raw/main/zsh-proxy.plugin.zsh'
From GitHub:
zinit light xooooooooox/zsh-proxy
Using Antigen
Add the following to your .zshrc
file:
antigen bundle xooooooooox/zsh-proxy
Using prezto
- Clone this repository into your Prezto modules directory:
git clone https://github.com/xooooooooox/zsh-proxy ${ZDOTDIR:-~}/.zprezto/contrib/zsh-proxy
- Add the plugin to your
.zpreztorc
file:
zstyle ':prezto:load' pmodule \
... \
'zsh-proxy' \
...
- Clone this repository somewhere on your machine:
git clone https://github.com/xooooooooox/zsh-proxy ~/.zsh/zsh-proxy
- Add the following to your
.zshrc
file:
source ~/.zsh/zsh-proxy/zsh-proxy.plugin.zsh
- Initialize the plugin configuration:
init_zsh_proxy
- Configure proxy settings:
config_zsh_proxy
This will prompt you to enter:
- SOCKS5 proxy address (default: 127.0.0.1:6153)
- HTTP proxy address (default: 127.0.0.1:6152)
- No-proxy domains (default: localhost,127.0.0.1)
Command | Description |
---|---|
proxy |
Enable proxy settings |
noproxy |
Disable proxy settings |
lsproxy |
Display current proxy settings |
The plugin manages the following environment variables:
http_proxy
/HTTP_PROXY
https_proxy
/HTTPS_PROXY
all_proxy
/ALL_PROXY
no_proxy
/NO_PROXY
To enable automatic proxy activation on shell startup, edit ${XDG_CONFIG_HOME-${HOME}}/zsh-proxy/auto
:
# Disable auto proxy (default)
echo "0" >"${XDG_CONFIG_HOME-${HOME}}/zsh-proxy/auto"
# Enable auto proxy
echo "1" >"${XDG_CONFIG_HOME-${HOME}}/zsh-proxy/auto"
All configuration files are stored in ${XDG_CONFIG_HOME-${HOME}}/zsh-proxy/
:
auto
: Controls automatic proxy activationhttp
: HTTP proxy URLsocks5
: SOCKS5 proxy URLno_proxy
: Comma-separated list of domains to bypass proxy