Browser search engine shortcuts

You can add Sourcegraph as a browser search engine to quickly search Sourcegraph from your browser's location bar when you type a special shortcut, such as src. This is one of the most common ways to initiate a search on Sourcegraph.

Adding Sourcegraph as a browser search engine

The easiest way is to install the Sourcegraph browser extension, which automatically configures the location bar src shortcut to search Sourcegraph.

Google Chrome

  1. Perform a code search on the Sourcegraph instance you want to add as a search engine.
  2. Copy the URL of the search results page.
  3. Go to chrome://settings. Under Search engine, click Manage search engines. Next to Other search engines, click ADD.
  4. In the Add search engine form, paste the URL you copied (in step 1) in the URL with %s in place of query field. Insert the string %s into the URL's ?q= query parameter (and remove any parts of the query that you don't want to keep).
  5. Fill in the keyword field with the keyboard shortcut you want for searching on Sourcegraph. In this example, it's set to s.

5.Click ADD.

To use the shortcut, focus in the browser address bar, type in the keyword you chose (such as src), and press Tab. Now type your Sourcegraph code search query and hit enter. You'll be taken to the search results page on your Sourcegraph instance.

For more information on setting Chrome search engines, see Chrome's help page.


To add Sourcegraph as a search engine in Firefox:

  1. Visit (or your own Sourcegraph instance)
  2. Click the three dots in the URL bar and choose Add Search Engine:


  1. You may then search using your URL bar and select Sourcegraph from the list of search engines:


To configure a shortcut (keyword) for quicker access:

  1. In the URL bar, enter about:preferences#search
  2. Scroll down to One-Click Search Engines, double-click the Keyword cell for Sourcegraph and type in a shortcut (such as src).

To use the search engine, type src Tab in the URL bar, then type your Sourcegraph search query. Pressing Enter will then go right to Sourcegraph!

See "Add or remove a search engine in Firefox" for more information.

Other web browsers

Consult your web browser's documentation or settings page for information on how to add custom search engines. Most web browsers support this feature.