ctrl+shift+p filters: :st2 :st3 :win :osx :linux

Open URL

by noahcoad ST2/ST3

Open URLs, files, folders, or google text under the cursor or in selected text for Sublime Text.


  • 2 2013.
    3 2.5.0
  • github.​com
  • github.​com
  • 7 days ago
  • 2 hours ago
  • 6 years ago


  • Total 16K
  • Win 8K
  • OS X 5K
  • Linux 3K
Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6
Windows 1 3 3 0 2 1 5 4 4 5 3 1 5 5 1 5 4 1 4 5 6 6 5 3 4 3 8 5 6 3 4 1 6 4 3 4 5 6 1 0 0 7 5 10 6 1
OS X 2 6 2 0 3 3 1 5 1 8 0 1 1 1 1 1 2 2 1 4 3 4 2 2 0 2 3 0 0 4 2 2 1 1 0 3 4 3 1 0 0 2 3 0 4 4
Linux 1 3 2 0 1 2 1 4 2 1 0 0 1 0 2 1 2 0 0 1 1 0 1 2 3 1 0 0 0 0 1 2 0 2 2 5 0 3 2 0 0 0 0 1 1 0



Open URL


Quickly open files, folders, web URLs or other URLs from anywhere in Sublime Text.


Look for Open URL using the Package Manager

How to use

Put the cursor inside a file / folder / URL / word and run the command. It automatically expands the selection until it hits delimiter chars, which can be changed in the settings (see below).

Alternatively, highlight the text you want to open. If text is highlighted the selection is not expanded.

Here's a bunch of ways you can run the command.

  • ctrl+u (OSX), ctrl+alt+u (Linux/Windows)
  • right-click > Open URL
  • alt + double-click
  • shift+cmd+p, then look for Open URL

Give it a try

Copy the items below to Sublime Text. Place your cursor inside any one of them and hit ctrl+u for OSX, or ctrl+alt+u for Linux/Windows.

How does it work?

If your selection is a file or a folder, you can choose to edit it (open with Sublime Text), or reveal it (open with macOS Finder/Windows File Explorer/Linux File Manager).

Opening files and folders is super convenient. Both can be specified with absolute paths, paths relative to the currently open file, or paths relative to the root of the currently open project. Env vars and the alias ~ are expanded.

If your selection is a URL, it opens immediately in a new tab in your default web browser. You can omit the scheme (http://) if you want and Open URL will add it for you.

If Open URL fails to open a web URL, you might have to change the path to your web browser executable. See the web_browser_path setting below.

If your selection is none of the above, and you haven't configured custom commands for special URLs using other_custom_commands, you'll be presented with two options:

  • modify the selection and try again
  • search for the selection using one of your configured web_searchers
    • the only web searcher that ships with Open URL is Google search
    • to add others, read more in the “Settings” section below


Don't want to choose from menu items to open a file or a folder? Look for Open URL (Skip Menu) in the Command Palette. To create a key binding for this, open Preferences: Key Bindings from the Command Palette, and add the following:

{ "keys": ["your+key+binding"], "command": "open_url", "args": { "show_menu": false } },

This will open files in Sublime Text for editing, or reveal folders in the Finder, without showing the menu first.

Running shell commands on files, folders or special URLs

Open URL provides a few settings you can configure to run custom shell commands on files, folders, or special URLs, such as FTP URLs:

  • file_custom_commands
  • folder_custom_commands
  • other_custom_commands (for special URLs, i.e. neither files, folders, nor web URLs)

The custom command settings should point to an array of objects that can have up to 5 properties:

  • label, required: the label for the command in the dropdown menu
  • commands required: a string, or an array of shell arguments, to which the URL is appended; if string/array contains the $url placeholder, this placeholder is replaced with the URL, and URL is not appended to end of string/array
  • pattern, optional: the command only appears if the URL matches this pattern
  • os optional: the command only appears for this OS; one of ('osx', 'windows', 'linux')
  • kwargs, optional: kwargs that are passed to subprocess.Popen

For example, the reveal command for files uses the following file_custom_commands.

"file_custom_commands": [
  { "label": "reveal", "os": "osx", "commands": ["open", "-R"] },
  { "label": "reveal", "os": "windows", "commands": ["explorer", "/select,"] },
  { "label": "reveal", "os": "linux", "commands": ["nautilus", "--browser"] },

For another example, if you wanted to create OSX commands for adding a folder to the current project or for opening a folder in a new window, you could do something like this:

"folder_custom_commands": [
  { "label": "add to project", "os": "osx", "commands": ["open", "-a", "Sublime Text"] },
  { "label": "open in new window", "os": "osx", "commands": ["/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"] },

Set cwd directory for shell command

You might want to choose the directory from which your shell command is executed. Python's subprocess library makes this easy with the cwd kwarg.

Open URL defines two special values for the cwd kwarg, "project_root" and "current_file". Using these values dynamically sets the working directory for the shell command to the project root, or the directory of the currently open file.

Check the Settings section, or run Open URL: Settings for examples.

Multiple Cursors

Copy these URLs into Sublime Text and select both lines using multiple cursors, then run URL opener.

The plugin opens both URLs simultaneously. You can use multiple cursors to open multiple files, folders, URLs, or a mix of all of them. Note that running Open URL with multiple cursors will skip the menu, as if you had run Open URL (Skip Menu), for all selections.


To customize these, hit shift+cmd+p to open the Command Palette, and look for Open URL: Settings.

  • delimeters
    • characters at which auto-expansion of selected path stops, e.g. \t\n\r\"',*<>[]()
    • the default settings are Markdown friendly
  • trailing_delimiters
    • if any of these characters are seen at the end of a web URL, they are recursively removed; default is ;.:
  • web_browser
    • the browser that Open URL uses to open new tabs; must be a string from this list
    • if you use an empty string, the “default browser” will be used
    • if you choose a browser that's not installed on your machine, Open URL will complain
  • web_browser_path
    • the path to your web browser executable for opening web URLs
    • this setting overrides the default web browser and the web_browser setting
    • read the top answer here, or look in settings for examples
  • web_searchers
    • if your selection isn't a file, a folder, or a URL, you can choose to pass it to a web searcher, which is just a URL that searches for the selected text
    • example: { "label": "google search", "url": "http://google.com/search?q=", "encoding": "utf-8" }
  • file_custom_commands
    • pass a file to shell commands whose pattern matches the file path
    • example, for copying the file path to the clipboard: { "label": "copy path", "commands": "printf '$url' | pbcopy" }
  • folder_custom_commands
    • pass a folder to shell commands whose pattern matches the folder path
    • example, for opening the folder in iTerm: { "label": "open in terminal", "commands": [ "open", "-a", "/Applications/iTerm.app" ] }
  • other_custom_commands
    • pass a URL which is neither a file, a folder, nor a web URL to shell commands whose pattern matches the URL
    • example, for opening a file at a specific line number: { "label": "subl: open file at line #", "pattern": ":[0-9]+$", "commands": [ "subl" ], "kwargs": {"cwd": "project_root"} }


See also: Google Spell Check.

Credits: Thanks goes to peterc for starting a forum thread about this topic and KatsuomiK for his gist, which were the inspiration for this plugin.

Author: @noahcoad writes software for the heck of it and to make life just a little more efficient.

Maintainer: @kylebebak.