Skip to content

Instantly share code, notes, and snippets.

@ueokande
Last active August 29, 2015 14:02
Show Gist options
  • Save ueokande/c5ea82911b3dc69802a6 to your computer and use it in GitHub Desktop.
Save ueokande/c5ea82911b3dc69802a6 to your computer and use it in GitHub Desktop.
Vimium Search Engine
(function (query) {
engines = {
'g' : function (q) { return 'https://www.google.com/search?q=' + q },
'd' : function (q) { return 'https://duckduckgo.com/?q=' + q },
'y' : function (q) { return 'http://search.yahoo.com/search?p=' + q },
'w' : function (q) { return 'http://en.wikipedia.org/wiki/' + q },
't' : function (q) { return 'https://twitter.com/search?q=' + q },
'b' : function (q) { return 'http://www.bing.com/search?q=' + q },
};
defEngine = Object.keys(engines)[0];
first = query.split('%20')[0];
args = query.slice(first.length + 3);
openurl = first in engines ? engines[first](args)
: engines[defEngine](query);
window.open(openurl, '_self');
})('%s')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment