6

Is there a way to create Phabricator shortcuts? Like when I type T123 in the address bar, it should take me to https://secure.phabricator.com/T123. On the same note, I want shortcuts for Diffs and Pastes.

Here is a list of patterns I need a shortcuts to:

T - Any number
P - Any number
D - Any number

I don't mind using any browser trick or, in fact, using a Chrome extension to solve this for me. It would be a huge productivity boost.

PS: I primarily use Chrome so even a solution which is Chrome-specific should work for me.

12

Built-in Chrome functionality only allows shortcuts which start with a space-separated "keyword", e.g. T 123. Right-click the address bar, select "Edit search engines", and add several new search engines like this:

  • Keyword: T
  • URL: https://secure.phabricator.com/T%s

The same feature is available in Firefox. While it doesn't have a convenient way to add custom search engines, you can instead create a bookmark with the same URL (same %s syntax) and assign a keyword to it through the bookmark's "Properties" window.

  • 1
    Thanks, @grawity for sharing this! This is really handy. – sachinjain024 Mar 18 at 6:37
  • Thanks for sharing this trick, upvoted. Usually the diffIDs or taskIDs are shared in this format T{id}, D{id} (without space), so I would just want to paste the ID and press enter. – ua741 Mar 18 at 7:52
  • 5
    Then I would create a keyword for the whole Phabricator instance – typing phab <Space> <Ctrl+V> or p <Space> <Ctrl+V> might be faster than manually editing T123 to T 123. – grawity Mar 18 at 7:55
6

You can use Requestly chrome+firefox extension to setup URL shortcuts.

Here is an old article which explains how to setup URL shortcuts for JIRA projects. You can set up a similar Redirect Rule in Requestly to achieve this use case.

Follow these steps

  1. Install Requestly, if not already installed
  2. Create new Redirect Rule
  3. Define Source & Destination as

    Request URL -> Matches (Regex) -> /search\?q=T([0-9]+)/ig
    Destination https://secure.phabricator.com/T$1
    

Explanation

  1. Use Regex match to identify the Task/Diff/Paste number from Google Search Query
  2. Redirect to corresponding Phabricator URL using matched value

You can also use this - https://app.requestly.in/rules/#sharedList/1552883742989 to directly get above rule. You must have Requestly installed to import the rule.

Here is a screenshot for setting up the rule:-

enter image description here

PS: I built Requestly.

  • I just wrote an article covering this question & answer on Requestly's official medium channel to benefit the community - medium.com/@requestly_ext/… – sachinjain024 Mar 18 at 6:51
  • 1
    This should probably match a larger part of the URL (at least including google.com or OP's other default search engine), otherwise it may trigger on searches on quite a few websites which use /search?q=... (For that matter, it'll probably trigger on regular attempts to google T<numbers>?) – grawity Mar 18 at 6:52
  • 2
    @grawity It can only trigger when search?q=T<numbers>. What I have is an idea and I hope OP can customize it according to his/her needs. Depending upon the situation, we can write more constrained regex but I leave that to the OP and others using the rule. – sachinjain024 Mar 18 at 6:58
  • This looks good. How can I modify the regex so that it does not redirect for T12312 some text? – ua741 Mar 18 at 8:00
  • 3
    You can just add $ to the end (or [$&] if you also want to catch the case of possible additional search parameters). There are some really good online regex testers out there, with which you can easily edit and test your regex in realtime :-) – Falco Mar 18 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.