Skip to content

Instantly share code, notes, and snippets.

@petitviolet
Created June 24, 2014 08:26
Show Gist options
  • Save petitviolet/cd669a6952a2116c558e to your computer and use it in GitHub Desktop.
Save petitviolet/cd669a6952a2116c558e to your computer and use it in GitHub Desktop.
hatena bookmark search command at vimperator
(function() {
// change to your hatena user name!!!
var HATENA_USERNAME = 'petitviolet';
liberator.modules.commands.addUserCommand(
["hatena[bookmark]", "hb"],
"search from my hatena bookmarks",
function(args){
if (args.length === 0) {
liberator.echo('input a query!');
return false;
}
// make "and" query
var query = args.join("+");
var hatenaUrl = 'http://b.hatena.ne.jp/' + HATENA_USERNAME + '/search?q=';
// open in a new tab
liberator.open(hatenaUrl + query, liberator.NEW_TAB);
return false;
},
{},
true
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment