Skip to content

mangefox/Sublime-Colorcoder

 
 

Repository files navigation

Colorcoder

this plugin for Sublime Text will highlight every variable in its own, consistent color — feature known as semantic highlighting, variable-name highlighting, contextual highlighting — you name it. code from rosettacode.org used under GNU FDL 1.2

Notice how all instances of m_nValue share the same color

Motivation

  • “Coding in color” by Evan Brooks
  • actually thought about something to improve the current highlighting system and accent the data flow
  • help dysgraphic/dyslexic coder

it is important to note i use a crc8 hash of the variable name to give similar named variables distinct colors to improve typo recognition

Options

Colorcoder allows you to specify white- and blacklist for file-types to highlight: the settings are enabled_for and disabled_for. If enabled_for is present in the config only those file-types will be highlighted, disabled_for wont be highlighted even if present in whitelist.

Installation

download the zip-ball and unpack to sublime\data\packages or via packageControl

On the first run plugin will cast magic to make everything work, it will even automatically reapply when change your color scheme (to turn this off set auto_apply_on_scheme_change to false). You can use ToolsPackagesColorcoder Tweak Colorcode on current color scheme (or CTRLSHIFTP it) to modify the colors a bit (note: the plugin will not actually modify the scheme but create a modified copy in its own directory and apply it)

As few language definitions provided by Sublime are insufficient for optimal Colorcoder results i bundle tailored defintions. You can set them up as default via language menuOpen all with current extension as*** (Colorcode) or copy/hardlink Packages/Colorcoder/***.tmLanguage to Packages/***/***.tmLanguage. You can also add more scopes for the plugin to colorize via the scopes setting. Colorcoder comes with a handy command colorcoder_inspect_scope which will print the scope of the token under text cursor to the console. You can bind it to a key (e.g. CTRLF12) by adding following to PreferencesKey Bindings – User

{ "keys": ["ctrl+f12"], "command": "colorcoder_inspect_scope"},

Sometimes things we are interested in don't have distinct scope e.g. the variables in Javascript are only source.js. You would need to modify the .tmLanguage.

  • First you need to obtain it - it is inside the same names .sublime-package file, which is a zip-archive

  • now locate first instance of

      <key>patterns</key>
      <array>
    

it should be somewhere within first 50 lines

  • use code folding to find where according </array> is

  • place following right before it

      <dict>
      	<key>comment</key>
      	<string>colorize everything</string>
      	<key>match</key>
      	<string>\b\w+\b</string>
      	<key>name</key>
      	<string>colorize</string>
      </dict>
    

or modify the bundled .tmLanguage files, you probably would only need to replace the keywords

Contact

you can reach me via email: [email protected], twitter: @vprimachenko or visit the official irc channel freenode.net#colorcoder (webchat)

About

Semantic highlight for Sublime Text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published