Created
September 12, 2015 08:07
-
-
Save John-Appleseed/4d45a81ec5f9cb820ffc to your computer and use it in GitHub Desktop.
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
" fun! ExportEnv: Load exports from g:exports | |
command! -nargs=0 ExportEnv call ExportEnv(<f-args>) | |
fun! ExportEnv() | |
" Save shell state | |
:ShellBackup | |
"exe 'let shell_restore="'.escape(&shell, ' \').'"' | |
set shell=bash\ --rcfile\ $HOME/.do/Environment/root\ -ci | |
let $HEAD=system('env') | |
let envhead = split($HEAD, "\n") | |
for i in envhead | |
let keyvalues = split(i, "=") | |
silent! exec "let $".keyvalues[0]."=\"".keyvalues[1]."\"" | |
"echo "\n" | |
"for i in keyvalues | |
"echo i | |
"echo "let $" i | |
"execute "let $".i."=system('echo -n $".i."')" | |
"execute "let $".i."=)" | |
"execute "let $".i | |
"endfor | |
endfor | |
:ShellRestore | |
" Restore shell state | |
"exe 'set shell='.escape(shell_restore, ' \') | |
endf | |
"--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment