You can define custom search keywords in your browser to make common searches easier. How to do it isn’t well documented, so I’m showing you how here.
As an example, I have a custom keyword “pypi”, so I can search PyPI for a package name by typing “pypi some name” in my browser’s address bar, and it takes me directly to https://pypi.org/search/?q=some name.
You can create your own custom keywords to have shortcuts to all kinds of searches. You provide a URL with a placeholder %s in it. When you type the keyword in the address bar, the rest of the entry is plugged into the placeholder, and you jump to the resulting URL.
Handy keywords
These are some of the custom search keywords I use. You can use them as-is, adapt them as you need, or create your own. Instructions for creating keywords are further down the page.
- py: Search Python docs
- https://www.google.com/search?q=site%3Adocs.python.org%20%s
- pep: Find a PEP by number
- https://peps.python.org/pep-%s
- pypi: Find a PyPI package
- https://pypi.org/search/?q=%s
- gh: GitHub code search
- https://github.com/search?type=Code&q=%s
- gpy: Google search for Python things, but not Monty Python
- http://www.google.com/search?q=%s+python+-monty
- xlate: Translate text, auto-detecting the language
- https://translate.google.com/?sl=auto&tl=en&op=translate&q=%s
How to define a keyword in Firefox
Firefox defines custom keywords as bookmarks:
- Select Bookmarks - Manage Bookmarks from the menu to open the Library dialog.
- In the left-hand sidebar, select Quick Searches. You’ll see a handful of pre-defined searches.
- Using the gear drop-down at the top of the dialog, select Add Bookmark...
- Enter the URL of the search in the URL field. Use %s as the placeholder.
- Put the keyword you want to use in the Keyword field.
- You can give the bookmark a name to make it easier to find it later if you need to.
- Save the bookmark, and close the Library.
- Now you can use your keyword in the address bar.
How to define a keyword in Chrome
Chrome defines custom keywords as search engines in Settings:
- Select Preferences or type chrome://settings in the address bar.
- In the left-hand sidebar, select Search engine and then Manage search engines and site search.
- Scroll down to Site search.
- Click Add.
- Put a description in the Search engine field.
- Enter the URL in the URL field, with %s as a placeholder.
- Put the keyword in the Shortcut field.
- Click Add, then close the Settings tab.
- Now you can use your keyword in the address bar.
Comments
On some browsers you can also use %S (upper case) and it won’t url-encode the value. For example if you use
https://www.reddit.com/r/%S
, you will be able to usekeyword python/top
whereas it won’t work with %s.In Firefox, I didn’t have a “Quick Searches” folder in the left pane of my Manage Bookmarks dialog, not in my main profile, nor in a profile I created a couple of weeks ago. But one can create any folder one likes - that isn’t a magic location.
Add a comment: