Skip to content

Instantly share code, notes, and snippets.

@iilei
Last active December 19, 2015 17:28
Show Gist options
  • Save iilei/5991189 to your computer and use it in GitHub Desktop.
Save iilei/5991189 to your computer and use it in GitHub Desktop.
{
// Please see the README for more information on settings.
// Array of objects containing a regular expression
// and an optional coloring scheme
// see https://github.com/skuroda/PersistentRegexHighlight
"regex": [
{
// b = {"ho" : 42}
// this id ok: {} OK
"pattern": "\\{[^\\s|\\{|\\}]|[^\\s|\\{|\\}]\\}",
"color_scope": "sublimelinter.underline.warning"
,"underline" : true
}
, {
// var a = ( { A:1 } );
"pattern": "(?<=\\()[^\\S\n]|(?<![\n,\\r])[^\\S\n](?=\\))",
"color_scope": "sublimelinter.underline.warning"
// ,"underline" : true
}
, {
// trailing spaces
"pattern": "[^\\S\n]+(?=\\n)",
"color_scope": "sublimelinter.underline.warning"
}
, {
// function() OK
// function foo() OK
// not function ()
// or function foo ()
"pattern": "(?<=function)\\s+(?=\\()|(?<=function\\s\\S)\\s+(?=\\()|(?<=function\\s\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()",
"color_scope": "sublimelinter.underline.warning"
// , "underline" : true
}
, {
// function() OK
// function foo() OK
// function ()
// function 1 ()
// function foo_bar_buba_blah_1 ()
// function foo_bar_buba_blah_lm ()
// 20 characters max for function names - otherwise we'll have to avoid
// lookaheads
"pattern": "(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()|(?<=function\\s\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S\\S)\\s+(?=\\()",
"color_scope": "sublimelinter.underline.warning"
// , "underline" : true
}
, {
// NB: function foo_bar_buba_blah_lmo ()
"pattern": "function\\s?\\S{21,}\\s+\\(",
"color_scope": "sublimelinter.underline.warning",
"underline" : true
}
, {
// (function() { ... } versus ;(function() { ... }
"pattern": "(?<!;)\\s*\\(\\s*(?=function\\s*\\(.*\\)\\s*\\{)",
"color_scope": "sublimelinter.underline.warning",
"underline" : true
}
],
// If highlighting is enabled
"enabled": true ,
// If highlighting should occur when a view is loaded
"on_load": true,
// If highlighting should occur as modifications happen
"on_modify": true,
// File pattern to disable on. Should be specified as Unix style patterns
// Note, this looks at the absolute path to match the pattern. So if trying
// ignore a single file (e.g. README.md), you will need to specify "**/README.md"
"disable_pattern": [],
// Maximum file size to run the the PersistentRegexHighlight on.
// Any value less than or equal to zero will be treated as a non limiting value.
"max_file_size": 0
}
@iilei
Copy link
Author

iilei commented Jul 13, 2013

max chars / line can be acomplished using rulers in user settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment