-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupvim.js
41 lines (38 loc) · 1.2 KB
/
setupvim.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// WSH script to download my .g?vimrc
/*
curl https://raw.githubusercontent.com/dragon0/dotfiles/master/setupvim.js -o setupvim.js
cscript setupvim.js
*/
var shell = WScript.CreateObject("WScript.Shell");
var profile = shell.ExpandEnvironmentStrings("%USERPROFILE%");
shell.CurrentDirectory = profile;
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CreateFolder(".swp");
// based on https://gist.github.com/duncansmart/5821523
function download(url, file){
var xhr = new ActiveXObject("MSXML2.XMLHTTP");
xhr.open("GET", url, false);
xhr.send();
if(xhr.Status == 200){
if(fso.FileExists(file))
fso.DeleteFile(file);
var stream = new ActiveXObject("ADODB.Stream");
stream.Open();
stream.Type = 1; // adTypeBinary
stream.Write(xhr.ResponseBody);
stream.Position = 0;
stream.SaveToFile(file);
stream.Close();
}
else{
WScript.Echo(
"Error downloading " + url +
" (" + xhr.status + " " + xhr.statusText + ")");
}
}
download("https://raw.githubusercontent.com/dragon0/dotfiles/master/.vimrc", ".vimrc");
download("https://raw.githubusercontent.com/dragon0/dotfiles/master/.gvimrc", ".gvimrc");
// :)
shell.sendkeys("{CAPSLOCK}");
WScript.sleep(500);
shell.sendkeys("{CAPSLOCK}");