Shortcut to open new tab with selected text in Chrome

Solution 1:

There's a built-in service that opens a selected text URL in a default application. It requires the URL to have a scheme though and doesn't fall back to a Google search or anything.


You could also create a custom service that opens a URL or a Google search page:

input="$(cat)"
input="${input%\n}" # remove a possible trailing newline
if [[ "$input" =~ '://' ]]; then
    open "$input"
else
    open "http://www.google.com/search?q=$(echo -En "$input" |
    ruby -e 'require "cgi"; print CGI.escape($<.read.chomp)')"
fi

Solution 2:

Open Automator.app and create a new "Service". Choose "Service receives selected text", and choose "Google Chrome" as the application.

Then, drag "Run AppleScript" from the left pane to the right and paste:

on run {input, parameters}

    tell application "Google Chrome"
        set myTab to make new tab at end of tabs of window 1
        set URL of myTab to input
    end tell

    return input
end run

enter image description here

Then, save this Service, and give it a name like "Open selected text in Google Chrome".

Finally, go to System Preferences » Keyboard » Keyboard Shortcuts and look under "Services". Here, create a shortcut for your new service, e.g. Cmd-Shift-O.

enter image description here

This does currently not work for searching since Chrome doesn't treat text as an URL for opening. See @Lri's solution for this.

Solution 3:

It can be done much simpler:

  1. Select the text.

  2. Drag the text to your address bar.

  3. Press Enter.

Solution 4:

For the benefit of anyone looking at this question in 2014 or beyond, Google Chrome has implemented this feature.

Chrome go to URL