Add this to your .vimrc:
autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete
Try it out:
$ touch index.html $ vim index.html type: <ht[CTRL-X][CTRL-O]
autocompleteccsshtmljavascriptphppythonvimvimrcxml
Take the location, convert to string, and split twice:
vidID = document.location.toString().split("v=")[1].split("&")[0];
javascriptsplityoutube
JSON is an acronym for JavaScript Object Notation.
To create an object in JavaScript you can do:
var myobj = new Object(); myobj.prop = 1;
Using JSON you'd do:
var myobj = {prop:1};
To create a new array you can do:
var a = new Array(); a[a.length] = 1; a[a.length] = 2;
or using JSON:
var a = [1, 2];
arrayjavascriptjsonliteralobject
I had written this greasemonkey script in order to create _blank links. It'll work most anywhere you need this kind of thing:
var allLinks, thisLink;
allLinks = document.getElementsByTagName('a');
for (var i = 0; i < allLinks.length; i++) {
thisLink = allLinks[i]; thisLink.target = '_blank';
}
blankgreasemonkeyjavascriptjstarget