Skip to content

Instantly share code, notes, and snippets.

@RichNSD
Created February 5, 2023 11:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichNSD/5b8102a3d967a6a18ac771b324be1636 to your computer and use it in GitHub Desktop.
Save RichNSD/5b8102a3d967a6a18ac771b324be1636 to your computer and use it in GitHub Desktop.
Initially drafted in response to a forum post about adding language support for `Dockerfiles`. Then I got carried away and wrote a small manual.

Dockerfile Support

I can't believe it took me so long to figure out the answer to this- and it was right in front of my face the whole time. Regardless, now that I've finally figured this out for myself, I want to share the ✨ magic ✨ with everyone else.

So what is the solution- and where was it the whole time? Shockingly, this answer was actually right where it should have been... in the Online Manual.


Sublime 3 & TextMate Packages

As mentioned above, the answer was practically screaming at me from the Textastic Online Manual- more specifically, the Customization Section, which states:

Move your Sublime Text 3 packages, TextMate bundles and theme files into the [local [#Textastic] Directory(https://www.textasticapp.com/v9/manual/customization/custom_syntax_themes_templates.html#add-the-special-folder-called-textastic)].

The manual goes on to briefly describe what to look for regarding TextMate's [package].tmbundle & [name].tmtheme folders, but as a whole, the instructions regarding Package Imports is quite vague. So I want to clarify the subject before throwing the Dockerfile Language/Syntax Definitions at you. Though, if you don't want to wait and read my little guide...

Download dockerfile.tmbundle & Skip to the Instructions


Package Overview

The good news is, even though the official guide is somewhat... lacking in detail, the configuration isn't terribly strict. Below is a quick breakdown of both TextMate & Sublime Text 3 packages and the files that are required to make them work:

Language/Syntax Package Contents

Even though the Textastic Manual makes it sound like a TextMate Bundle (package) needs to go into a *.tmbundle or *.tmtheme folder, that's not actually the case. So long as the required files are inside any ../#Textastic/[package] folder, they should work just fine. For example, if you install docker.tmbundle according to the instructions below, then rename the .tmbundle folder to just docker, it will still work.

What really matters is that your TextMate Package Folder includes the following:

  • NOTE: Not all of the files listed below are required. Just make sure you find these files in whatever new packages you want to install, any other files aren't necessary (but they won't do any harm either).
  • All * characters in the table below represent the Package or Language name.
    • Example: *.tmbundle would be docker.tmbundle.
  • Sublime Text 3 supports TextMate packages and can include config files from both applications.
File/Extension Written in... Details
*.tmLanguage xml Typically the 'primary' definitions file.
*.YAML-tmLanguage yaml Also contains language definition settings. Not always included.
*.tmPreferences xml Additional configuration options (not required).
*.sublime-syntax yaml Sublime's primary definitions file.

That might not be all, folks

While I have put (probably too much) time and effort into making this as accurate as possible, there may still be some things I've missed. However, both applications have a painfully obvious naming scheme when it comes to their config files.

  • All TextMate config files are either .tm[Purpose] or .YAML-tm[Purpose].
  • Similarly, Sublime config files all contain sublime in the extension: .sublime-[Purpose]

Theme Packages

I'm going to be perfectly honest, I haven't imported any, so I have no practical experience on this one. All I know about them is that they follow the same extension naming schemes as mentioned in the previous section. The few I looked at also appear to have significantly more to them than the language packs, so to be on the safe side, you might want to just download/clone entire repositories and throw them into your #Textastic folder as-is.

But now, for the moment you've been waiting for (if anyone even bothered to read this far). Time to go over the Dockerfile package & installation.




Installing Dockerfile.tmbundle

  1. Download the dockerfile.tmbundle.zip.
    • Don't un-zip right away (or do ¯\_(ツ)_/¯ , but it's easier not to).
    • The zipped package is hosted from GitHub
  2. Move the ZIP archive into your local #Textastic directory
    • NOTE: the #Textastic folder is not automatically generated when you install the app and you need to create it manually.
    • Your manually-imported packages go in the top-level of the #Textastic. Do not place them inside Code Completion or Templates.
  3. From within the #Textastic Directory, simply tap the ZIP archive to automatically unpack it.
  4. Force-close and restart the Textastic app. New Dockerfiles should automatically apply the correct Syntax Definition.
    • Optional: Open the app's settings and Reload Customizations
      • Settings → Other → Reload Customizations
      • This usually isn't necessary, but if you can't find/manually select the Dockerfile (.dockerfile) Syntax after restarting the app, Reload Customizations usually does the trick (requires another app-restart).

Package Placement Examples

I know the concept is pretty straight-forward, but just in case there's any confusion...

Do this:

# Example of a correctly-imported package (path):
"[Local Files]/Textastic/#Textastic/${docker.tmbundle}"

Not this:

# Examples of where NOT to place your packages:
"[Local Files]/Textastic/#Textastic/Code Completion/${package.tmbundle}"
"[Local Files]/Textastic/#Textastic/Templates/${package.tmtheme}"



Enjoy!

I hope my hyperfixation on the subject proves helpful. I will be creating documentation (and other goodies) for Textastic, as I'm able, and will post them as I go.

Happy typing 😎

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