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

Clickable URLs

by pakhromov ALL

Underlines URLs in Sublime Text, and lets you open them by clicking or using a keybind.

Details

  • 2.1.0
  • github.​com
  • 2 weeks ago
  • 6 hours ago
  • 14 years ago

Installs

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

Readme

Source
raw.​githubusercontent.​com

Clickable URLs

This is a maintained fork of the original plugin.

A plugin for Sublime Text 4

Screenshot of a clickable URL

Summary

This plugin underlines URLs in Sublime Text, and lets you open them with a keystroke (Cmd+Option+Enter by default) or a single click (opt-in, see open_on_click below).

After you put the cursor over an URL, you can either hit Cmd+Option+Enter (Ctrl+Alt+Enter on Windows & Linux), or select “Open URL under cursor” from the Command Palette. Instead of selecting an auto detected URL, you can select any block of text and it will also open in a browser as a URL.

There is also an “Open all URLs” command, which opens every URL found in the current document, after asking you to confirm.

Performance warning. The plugin is automatically disabled if the document has more than 200 URLs or is larger than about 1 MB, in order to avoid a massive performance hit. Both limits are configurable - see “Performance” below.

Installation

With Package Control (open Command Palette(ctrl+shift+p), find Package Control: Install Package, search for Clickable Urls, hit enter), or just drop the plugin into Sublime Text's Packages folder.

Configuration

All configuration is done via the settings file that you can open via the main menu: Preferences > Package Settings > Clickable URLs > Settings - User.

Customising the browser

By default, Clickable URLs uses some default system browser. If it doesn't work for you, you can change the browser by setting the clickable_urls_browser in the ClickableUrls.sublime-settings file, to which you can get from the menu.

Anything from this list will work, for example:

{
    "clickable_urls_browser": "firefox"
}

Note for Windows users. If the browser you want won't open, you might have to specify the full path manually:

{
    "clickable_urls_browser": "\"c:\\program files\\mozilla firefox\\firefox.exe\" %s &"
}

Take note of the escaped slashes and the quoting around the name.

The ampersand at the end is significant - without it the editor will hang and wait for browser to close.

Disabling URL highlighting

To disable URL highlighting, set highlight_urls to false:

{
    "highlight_urls": false
}

Opening URLs with a single click

By default, URLs open via the keyboard shortcut. To enable single left-click to open, set open_on_click to true:

{
    "open_on_click": true
}

A 300ms delay is used to distinguish between a single click and a double (triple) click. Any drag or text selection cancels the pending open.

Note: because the delay starts on mouse press, if you click a URL and hold the button down longer than 300ms without moving, the URL will open even though you may still be trying to start a selection. If you want opening to trigger on mouse release instead, leave open_on_click disabled and add the following to your default sublime-mousemap (Command Palette(ctrl+shift+p) > Preferences: Mouse Bindings):

{
    "button": "button1",
    "count": 1, "press_command": "drag_select",
    "command": "open_url_on_click"
}

Customising the underline color

URLs are underlined in region.bluish by default. Change it with underline_color:

{
    "underline_color": "region.greenish"
}

Any valid scope name works (e.g. "region.bluish", "region.greenish", "region.yellowish").

Customising the underline style

The underline style can be changed from the default squiggly:

{
    "underline_style": "stippled"
}

Valid values are "solid", "stippled", and "squiggly".

Showing a clickable phantom icon next to each URL

An icon can be shown after each URL, the cursor changes to a pointer when you hover over the icon:

{
    "show_phantom": true,
    "phantom_icon": "⮊",
    "phantom_color": "blue",
    "phantom_size": "0.8em"
}

Clicking the icon opens the URL in your browser (same as using the keyboard shortcut).

Performance

Three settings control how much work the plugin does:

{
    "max_url_limit": 200,
    "max_file_size": 1048576,
    "debounce_ms": 500
}

max_url_limit - documents containing more URLs than this are ignored.

max_file_size - documents longer than this (counted in characters), are ignored.

debounce_ms - how long to wait after you stop typing before rescanning the buffer.

Known Issues

  • URLs are not underlined in Markdown files when using the MarkdownEditing plugin plugin (that plugin applies its own styles to the URLs). Otherwise ClickableUrls works as usual.

© 2015 Leonid Shevtsov under the MIT license.