A Cloudflare Worker that simplifies web search by providing "bang" shortcuts for popular search engines. By default, all queries are redirected to Kagi Search, but you can use special "bang" commands to instantly redirect your search to Google, Perplexity, DuckDuckGo, or Metaphor.
- Default Search: All queries go to Kagi Search unless a bang is used.
- Bang Shortcuts: Use special commands in your query to search with a different engine:
!g→ Google Search!p→ Perplexity!d→ DuckDuckGo!met→ Metaphor!(at start/end/standalone) → DuckDuckGo
- Recall Last Query: Use
!!in your query to recall and reuse your previous search (stored in a 1-deep cache). - Customizable: Easily modify the default engine or add new bangs in
src/index.ts.
- Enter a search query as usual.
- Example:
how to make sourdough→ redirects to Kagi.
- Example:
- Add a bang to use a different engine:
how to make sourdough !g→ Google!p sourdough starter→ Perplexity!met bread science→ Metaphor!d privacy search→ DuckDuckGo! what is a bang→ DuckDuckGo
- Use
!!to recall your last query and combine it with a new bang:!! !g→ sends your previous query to Google.
-
Clone the repository:
git clone <repo-url> cd pplx-bangs
-
Install dependencies:
bun install
-
Create the KV namespace for query caching:
bunx wrangler kv:namespace create QUERY_CACHE
- Add the output to your
wrangler.tomlas instructed.
- Add the output to your
-
Publish the Worker:
bunx wrangler publish
-
Set the published Worker URL as your browser's default search engine.
- To change the default search engine or add new bangs, edit
src/index.ts. - The bang logic is in the
handleSearchfunction.
MIT