Created
September 2, 2011 22:29
-
-
Save atomicules/1190099 to your computer and use it in GitHub Desktop.
Extracts/examples from my .vimrc to make settings conditionally based on OS and network
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
"IP Address specific | |
"------------------- | |
"(i.e. Home or Work) | |
if ip == -1 | |
"Set proxies, Python urllib2 (TwitVim, Simplenote.vim) will automatically pick | |
"these up | |
let $http_proxy = 'http://<username>:<password>@<proxy-url>:<proxy-port>' | |
let $https_proxy = 'http://<username>:<password>@<proxy-url>:<proxy-port>' | |
endif |
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
"OS Specific | |
"----------- | |
let os = substitute(system('uname'), "\n", "" ,"") "thanks to http://objectmix.com/editors/149466-operating-system-checking-vimrc-files.html#post517594 | |
if os == "Linux" | |
... | |
let ip = match(system('ip addr show'), "10.0.1") | |
elseif os == "Darwin" | |
... | |
let ip = match(system('ipconfig getifaddr en1'), "10.0.1") "Or whichever enX interface you need | |
else "Assume windows as uname doesn't work on Windows | |
... | |
let ip = match(system('ipconfig'), "10.0.1") | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment