Skip to content

3.1.0

Choose a tag to compare

@noahcoad noahcoad released this 09 Sep 04:27
· 6 commits to master since this release

3.1.0

What's new

Paths with spaces select whole from inside brackets

Only the quote pairs (`"" '' ```) used to hold a spaced path together.
The bracket pairs fell through to the plain token walk and split at the first
space, so this never resolved:

(~/OneDrive/Q CST - ALL/Customers/3M)

(), [], {}, and <> are now enclosing pairs too. Brackets nest, so
they're depth-matched in both directions — a markdown - [ ] checkbox is no
longer mistaken for an opener — and when pairs nest, the innermost wins.
[my file.py]:42 also resolves now; the wrapper used to survive and break the
lookup.

${VAR} is still a path chunk, never a brace pair, so ${HOME}/Desktop
selects whole.

Wrapped path plus prose

When the quotes wrap a path and a comment, the whole string isn't a path,
so the wrapper is ignored and the token under the cursor is used instead:

- "~/txt/notes.txt — reference for this prompt"

The cursor anywhere in the path opens the file, :42 suffix included. This
only kicks in when the wrapped text doesn't resolve and the bare token does,
so a genuine spaced path ("~/Q CST - ALL/3M") still selects whole. Put the
cursor in the prose half and you get the whole quoted string.

Markdown links resolve from anywhere inside them

The cursor can sit on either bracket, in the label, on the paren, or in the
target of an inline [label](target) link — Open URL resolves the
target. Handles targets with spaces (bare or <angle>-wrapped), a "title"
suffix, one level of nested parens, and deep-link suffixes. Empty targets fall
back to plain expansion.

Use Input prefills from the clipboard

Open URL: Use Input opened an empty panel. It now prefills (and Sublime
preselects) the clipboard when it looks like a path or URL — anything that
resolves on disk, including deep links (~/notes.md:85) and paths with
spaces, plus single path-ish tokens (~/, ./, /, C:\, ://, a bare
domain) so a not-yet-created path can be edited before opening. Whitespace, an
enclosing quote/bracket pair, and a file:// scheme are stripped first. Prose,
multi-line, and oversized clipboards leave the panel empty, as before.

New command: System Open this File

Open URL: System Open this File hands the file in the active view to the OS
default opener — open on macOS, xdg-open on Linux, cmd /c start on
Windows. It's the system_open menu action aimed at the file you're editing
rather than a path under the cursor, so there's nothing to select first. Handy
for previewing a markdown file, HTML page, image, or CSV in its registered app.

macOS Linux/Windows
Open URL: System Open this File ctrl+alt+o ctrl+alt+shift+o

On Linux/Windows the binding avoids ctrl+alt+o, which SFTP and
OmniMarkupPreviewer already claim. Disabled for unsaved buffers, since there's
no path to hand off. Like every default binding, it's silenced by
open_url.disable_default_key_bindings.

Wrapping copied and pasted paths

Two new settings keep a path or deep link re-selectable as one token wherever
it lands. Both default to a backtick, matching what Markdown views already did.

Setting Default What it does
plain_text_path_wrap_char "`" Encloses a path pasted by Paste Relative Path in a non-Markdown view when it holds a space (or another char that would break re-selection) or carries a deep-link suffix.
copy_path_wrap_char "`" The copy-side mirror: encloses a path or deep link put on the clipboard by Copy Deep Link / Copy Transformed Path. Deep links always; plain paths only when a char would break re-selection.

So ~/notes.txt:42:/^first five words/ copies as
`~/notes.txt:42:/^first five words/` and pastes back as one token.

If the wrap char already appears in the path, the next available quote (",
', `) is used. Set either to "" for the previous behavior — bare on
copy, and on paste a quote only when a char would break re-selection.

Paste Relative Path strips one enclosing pair off the clipboard, so a
wrapped link round-trips without doubling up.

Fixes

  • parse_file_location stripped quotes but not brackets, so a bracket-wrapped
    deep link kept its wrapper and wouldn't resolve.
  • The enclosing-delimiter set had drifted across four hardcoded lists — {}
    was missing from all of them. Everything now derives from one
    ENCLOSING_PAIRS tuple.
  • ${VAR} had two different spellings in the code that disagreed on
    ${A B}; now one definition, shared by the token walk and the deep-link
    regex.
  • The test suite moved into tests/, so Sublime stops logging
    reloading plugin open-url.test_open_url on every save.

Compatibility

No settings changed meaning and no keybinding was reassigned. The only
user-visible default shifts are the two new wrap chars — set both to "" to
get 3.0.1's copy and paste output back:

{
  "plain_text_path_wrap_char": "",
  "copy_path_wrap_char": ""
}