Skip to content

sugilog/websearch.vimpr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

websearch.js

Websearch.js is a vimperator plugin for user customisable web search commands.

Requires

  • Firefox

  • Vimperator (Firefox addons)

Usage

You can use :[custom_name] [keyword] to search on web searvice, like below.

:alc fire

It will be opened ALC in new tab, and search with keyword ‘fire’. If you add bang (!), it will be opened in current tab.

You also can use its command without keywod

:alc

It will be openen ALC home page. (It is also registered into quickmarks with its command names initial.)

All websearch.js command is managed in webSearchTemplates object. alc template is berow.

liberator.globalVariables.webSearchTemplates = [
  { names: ['alc'], description: 'search alc', url: 'http://eow.alc.co.jp/%KEYWORD%/UTF-8/', tabOpen: true, urlWithoutKeyword: 'http://www.alc.co.jp' }
];

custom template

You can add custom command on .vimperatorrc, like below.

javascript <<EOM
liberator.globalVariables.webSearchTemplates = [
  { names: ['gems'], description: 'search rubygems.org', url: 'http://rubygems.org/search?utf8=%E2%9C%93&query=%KEYWORD%' }
];
EOM

Custom template will be merged template of websearch.js default template.

webSearchTemplates attribues.

names

type

String Array OR String

requirement

require

note

Command name

example
‘alc’

description

type

String

requirement

optional

note

command description

example

‘search alc’

url

type

String

requirement

require

note

url for search with keyword. the part of keyword need to replace %KEYWORD%

example

eow.alc.co.jp/%KEYWORD%/UTF-8/’

tabOpen

type

boolean

requirement

optional

note

tabOpen status (default true). if tabOpen is set false, command without bang (!) will be opend in current tab

example

true

urlWithoutKeyword

type

String

requirement

optional

note

url for open web searvice without keyword (like a bookmark). it is also registerd into quickmarks

example

www.alc.co.jp

if urlWithoutKeyword is not set, it will be generated with host of url.

'http://rubygems.org/search?utf8=%E2%9C%93&query=%KEYWORD%' => 'http://rubygems.org/'

urlWithoutKeyword is registerd into quickmarks with its command names initial. (If names are set multiple command name, websearch.js use first command name.)

'alc' => 'qmark a http://www.alc.co.jp/'

Releases

No releases published

Packages

No packages published