---
title: Make the Most of your Browser’s Address Bar
teaser: 'Address bar aliases simplify everyday tasks in the browser.

  '
tags: productivity,web
author: Stephen Hanson
published_on: 2019-06-10
---

If you’re like me, you have tens or even hundreds of [terminal
aliases](https://github.com/stevehanson/dotfiles/blob/master/zsh/aliases.zsh)
set up to simplify commands that you do multiple times a day. Some of my
personal favorites that I’ve set up in my terminal are `g-` to check out the
previous git branch, `gunc` and `gam` to un-commit or amend my latest git
commit, and `ya` and `yad` to add a Yarn dependency or development dependency.
To any passersby, my terminal history is basically a series of two to three
character gibberish commands.

It occurred to me recently that, while I spend so much time tweaking my
terminal, I hadn’t given much thought to my browser workflow. This got me
wondering if there was something similar to terminal aliases I could use in my
browser’s address bar to make me more productive in the browser. The answer:
Yes, there is!

This article will walk through how I set up the following address bar shortcuts,
focusing specifically on Chrome and Firefox: 

* Open any of my repos on GitHub with `gh<space>my_repo<enter>`, or open a
  thoughtbot repo with, eg. `tb<space>factory_bot<enter>`
* Open the project I'm currently working on in GitHub with `gp<enter>`
* Search through my browser history with `h<space>` then a search term

Coupled with the fact that you can focus your browser's address bar anytime with
`ctrl/cmd + l`, these shortcuts have made my workflow quite a bit more
productive.

## The Shortcuts

Setting these up is pretty simple in both Chrome and Firefox, but the process is
different for each. In Chrome, we will be adding custom "search engines" that
are triggered by our keywords. In Firefox, we will just be creating bookmarks
and then editing them to be triggerable by keywords. Both browsers support
adding `%s` to the URL to accept input from the address bar and substitute it in
the URL.

### Shortcut 1: Open your GitHub repos with text input

The first shortcut we'll set up will let us quickly open any of our own GitHub
repos. The goal is that typing, for example, `gh<space>dotfiles` in the address
bar will take us to our GitHub repo called "dotfiles".

#### Chrome

To set this up in Chrome, we will [add a search engine][chrome-search-engines].
Right click your address bar, click "Edit Search Engines", and then “Add”. Title
it "My GitHub Repo" with keyword "gh" and URL
"https://github.com/your_gh_username/%s".

<img
  alt="GitHub repo Chrome search engine."
  style="width:525px; max-width: 100%"
  src="https://images.thoughtbot.com/sh-make-the-most-of-your-browser-s-address-bar/BlRCL6IS7aEQCGFOJLbA_alias-gh.png"
/>

#### Firefox

To set this up in Firefox, [add a bookmark][firefox-bookmarks] to one of your
GitHub repos, then edit the bookmark to use the "gh" keyword and have "%s" in
the URL: 

<img
  alt="GitHub repo Firefox bookmark."
  style="width:350px; max-width: 100%"
  src="https://images.thoughtbot.com/sh-make-the-most-of-your-browser-s-address-bar/KtdV3euoSxOPiICcoap5_alias-gh-firefox.png"
/>

If you frequently work on repos in a certain GitHub organization, it's useful to
set up aliases for that organization, too. I have a `tb` alias for getting to
thoughtbot repos.

### Shortcut 2: Open your current project in GitHub

The next shortcut I use is a simple one that allows me to open my current
project in GitHub by typing `gp<enter>` in the address bar. At thoughtbot, we
work on one client project at a time, so I always keep this up-to-date to point
to my current client project. I also set up `pm<enter>` to take me to the
project management tool for my project. I sometimes have another project that
I'm tinkering on during my [investment time][investment-time], which I usually
alias to the uninspired `gp2`.

Follow the same approach as the last shortcut to set this up in Chrome or
Firefox. This one is simple and doesn't require using `%s` in the URL.

<img
  alt="Current project Chrome search engine."
  style="width:525px; max-width: 100%"
  src="https://images.thoughtbot.com/sh-make-the-most-of-your-browser-s-address-bar/SofDXmfaQbIWvSSylcRu_alias-gp.png"
/>

### Shortcut 3: Search through your browser history and other tricks

Firefox is the winner in this category. It comes out of the box with some very
useful [advanced search operators][awesome-bar]:

* `^` - matches history
* `*` - matches bookmarks
* `%` - matches currently open tabs
* `#` - matches page titles

For example, typing `^ doge` in the address bar searches your history for
"doge".

I haven't been able to find any similarly useful operators for Chrome, but I
have set up a shortcut that searches my history. To do this, add a search engine
called “History”, with keyword “h” and URL “chrome://history/#q=%s”. Now, you
can type `h<space>cats`, and the URL bar results will populate with items from
your history that match “cats”.

<img
  alt="History Chrome search engine."
  style="width:525px; max-width: 100%"
  src="https://images.thoughtbot.com/sh-make-the-most-of-your-browser-s-address-bar/wcTiSOBzTHIc97MrOclU_alias-h.png"
/>

### Wrapping up

There's a lot more you can do with your address bar that I haven't touched on
here. For example, you can execute JavaScript for advanced functionality, though
there are some limitations around where and how this works, especially in Chrome
where JavaScript [doesn't work from the new tab page][chrome-js-limitations]. If
you want full control of your address bar, you can always make a [browser
extension][how-to-make-a-browser-extension] (check out the OmniBox APIs for
[Chrome][omnibox-chrome] and [Firefox][omnibox-firefox]).

I hope sharing my recent learnings has gotten you interested in boosting
productivity in the browser. We'd love to hear some of your favorite browser
productivity tricks and tools. [Let us know on Twitter][twitter-tweet]!

[chrome-search-engines]: https://support.google.com/chrome/answer/95426
[firefox-bookmarks]: https://support.mozilla.org/en-US/kb/bookmarks-firefox
[investment-time]: https://thoughtbot.com/playbook/our-company/time#investment
[awesome-bar]: https://support.mozilla.org/en-US/kb/awesome-bar-search-firefox-bookmarks-history-tabs#w_changing-results-on-the-fly
[how-to-make-a-browser-extension]: https://thoughtbot.com/blog/how-to-make-a-chrome-extension
[omnibox-chrome]: https://developer.chrome.com/extensions/omnibox
[omnibox-firefox]: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Omnibox
[chrome-js-limitations]: https://bugs.chromium.org/p/chromium/issues/detail?id=98871
[twitter-tweet]: https://twitter.com/thoughtbot
