Last active
May 8, 2020 14:59
-
-
Save ageekymonk/bed829c85a0bb8ef42e1bbc443fa4544 to your computer and use it in GitHub Desktop.
spacemacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; Proxy | |
(defun module/proxy () | |
"Set Proxy" | |
(defun set-work-proxy () | |
"Set your work proxy." | |
(interactive) | |
;; Set proxy configurations in emacs | |
(setq url-proxy-services | |
'(("no_proxy" . "^\\(localhost\\|127.0.0.1\\)") | |
("http" . "localhost:3128") | |
("https" . "localhost:3128"))) | |
;; Set environment variables for shell to work | |
(setenv "no_proxy" "^\\(localhost\\|127.0.0.1\\)") | |
(setenv "http_proxy" "http://localhost:3128") | |
(setenv "https_proxy" "http://localhost:3128") | |
;; Set git configuration to include proxy | |
(setq magit-git-global-arguments '("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "http.proxy=localhost:3128"))) | |
(defun unset-work-proxy () | |
"Unset your work proxy." | |
(interactive) | |
;; Set the proxy to nil | |
(setq url-proxy-services nil) | |
(setenv "no_proxy" "") ; Set the environment to null as some emacs library relies on this. | |
(setenv "http_proxy" "") | |
(setenv "https_proxy" "") | |
;; Set the git config proxy to nil. | |
(setq magit-git-global-arguments '("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false"))) | |
(spacemacs/set-leader-keys (kbd "pw") 'set-work-proxy) | |
(spacemacs/set-leader-keys (kbd "pW") 'unset-work-proxy)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment