Git Product home page Git Product logo

regexlink's Introduction

RegExLink

A Sublime Text plugin that open links and commands formatting it using a regular expression.

With this kink of definition you can open a link direcly in your browser or open a filesystem path in explorer. It's very useful to combine keyword with url so you can make a Google search typing something like GOOGLE:query or open the wikipedia page with a specific topic using WIKI:WikiPage.

I use it to trap something light BUG #1234 to open the bugtracker at the 1234 issue page.

You can define your custom regule expresion like in the following code. By default an url and a filesystem definition is configured.

  // URL 
  { 
     "name" : "Url",
     "regex" : "(http://[^\\s]+)",
     "link" : "$1",                                     // all the link 
     "style": "string"                                  // string, invalid, variable, comment, variable.parameter
  },
  // Open a path like C:\Users\Antonio\Documenti using Explorer 
  { 
     "name" : "Filesystem",
     "regex" : "file://([^\\s]+)",
     "command" : "explorer c:\\$1",                     //you can specify a command
     "style": "comment"
  },
  // Search on Google 
  //{ 
  //   "name" : "Google",
  //   "regex" : "GOOGLE:([^\\s]+)", 
  //   "link" : "https://www.google.it/search?q=$1",    //you can specify a link transformation
  //   "style": "variable"
  //},
  //{ 
  //   "name" : "Wikipedia",
  //   "regex" : "WIKI:([a-zA-Z0-9]+)",
  //   "link" : "http://en.wikipedia.org/wiki/$1",
  //   "style": "string"
  //},

Automatically maches are highlighted with colour of the style, so you can see something like in the following screenshot.

To open the link, use the command Open Link from Regular Expression, al selected region (you can also open multiple link with one command) or what is under the caret will be launched. You can also use the entry in the contextual menu.

The command for shortcut association is reg_ex_link

License

Copyright 2014-2014 Antonio Riva

regexlink's People

Contributors

antonioriva avatar mom1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mom1

regexlink's Issues

[Feature request] Disable highlighting option

1. Request

It would be nice, if would be possible to disable gutter marks and borders around regular expression.

2. Justification

  1. Gutter marks of RegexLink can disable gutter marks of other plugins as SublimeLinter or GitGutter.
  2. In most cases I don't need gutter marks and border around regular expression. This can be useful for me in debugging regex process, but no by default.

3. Settings

For example, I have default settings.

4. Steps to reproduce

I place carriage to any link → Ctrl+Shift+P (⌘⇧p for Mac) → Open Link from Regular ExpressionEnter.

5. Actual behavior

Actual

6. Expected behavior

If user set in User/RegExLink.sublime-settings:

"disable_highlights": true

Link still will be open in user default browser, but no gutter marks and borders around links.

Expected

7. Examples on other apps

In similar packages highlighting disable:

Thanks.

Default URL Capture http and https links?

I thought it might be helpful to change the default regex to include both http and https url formats. I think just changing (http://[^\\s]+) to (https?://[^\\s]+) should take care of it.

I'm using that format in my user settings with no issues, but it seemed like it might make sense as the default.

Option to disable link outlines

This is the only open file/URL plugin that just works, after trying more than a couple.
I just have one request, an option to disable link outlines as well. They look good for a couple of links but on a text file with lots of links, it gets noisy. I prefer to use just the gutter marks.

Thanks for the great work.

{
"regex_link_outlines": false
}

EDIT: setting "style": "" also disables the gutter marks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.