Search code examples
pythontextmatehamlyamlcoffeescript

Textmate Whitespace/Invisibles - Show Spaces


Is there a way to show "Soft Tabs" (spaces) in TextMate? ViewShow Invisibles works well for keeping track of indentation if you're using tabs for indentation. Unfortunately in languages where indentation is semantic you generally have to use spaces. (Python, YAML, HAML, CoffeeScript)

Any suggestions for showing this whitespace or keeping track of soft indentation in TextMate? Should I keep holding out for Textmate2?

Alternative strategies and suggestions are also welcome.


Solution

  • The latest version of TextMate 2 highlights spaces when Show Invisibles is enabled.

    invisibles


    EDIT:

    You can even customize which invisibles to show with which character by modifying the invisiblesMap property in .tm_properties file.

    From the TextMate changelog:

    This can be set to a string which is used to control which glyphs are used for invisible characters. Add either \n, \t, or a space to the string, followed by the glyph that should be used to render the character, or prefix it with ~ to disable rendering of that character. For example to disable rendering of spaces and render tabs as add this to .tm_properties: invisiblesMap = "~ \t┊".

    Sidenote:

    THIS IS NOT THE CASE ANYMORE, functionality has been restored.

    According to the Log of 2013-10-23 (v2.0-alpha.9489): "Show Invisibles will no longer treat space as an invisible (which was added in previous build) as it was causing issues with right-to-left rendering and combining marks used after spaces. The feature might be back, but needs to be implemented differently."