diff --git a/.zshrc b/.zshrc index 31f1b0e..62a7694 100644 --- a/.zshrc +++ b/.zshrc @@ -7,6 +7,25 @@ LIGHT_GREEN='\033[0;92m' BOLD='\033[1m' NC='\033[0m' # No Color +_proxy() { + local ip="172.22.11.69" + local port="8080" + + # Check if the IP and port are reachable + if nc -z -w5 $ip $port; then + # If reachable, set the proxy environment variables + export http_proxy="http://$ip:$port" + export https_proxy="http://$ip:$port" + export HTTP_PROXY="http://$ip:$port" + export HTTPS_PROXY="http://$ip:$port" + echo_info "Proxy set to: http://$ip:$port" + else + echo_error "IP $ip with port $port is not reachable." + fi + + alias proxy='echo "http: $HTTP_PROXY"; echo "https: $HTTPS_PROXY"' +} + # Message storage typeset -A _MESSAGES _MESSAGES=( @@ -118,6 +137,7 @@ _sources() { } _environment() { + _proxy if command_exists nvim; then export EDITOR="$(which nvim)" fi