Skip to end of metadata
Go to start of metadata

TextMate Bundles in PhpStorm

Projects may contain file types unknown to PhpStorm. While PhpStorm comes with built-in support for many programming and scripting languages, you may want to have syntax highlighting for project-specific languages. For example, a project may contain a shell script, or Perl. When doing infrastructure automation for your project using Puppet, a configuration file may exist in a project. TextMate, a text editor for Mac, offers syntax highlighting bundles for many languages. The good news is we can import them and use them in PhpStorm!

Obtaining TextMate bundles

The first thing to do is find a bundle for the language we want to use. TextMate has a GitHub organization in which bundles for many languages can be found. There is support for LaTex, Markdown, Objective-C, ASP.NET, Perl and so forth. If you need a language which isn't listed, chances are a simple search will yield a bundle. Here's one for Puppet.

From GitHub, we can simply clone the bundle to a local path if we want to make use of it. Let's work with shell scripts and clone that bundle:
git clone https://github.com/textmate/shellscript.tmbundle.git

Registering a TextMate bundle with PhpStorm

The next thing we want to do is register the bundle with PhpStorm. We can do this from the File | Settings menu and find the TextMate Bundles IDE settings. From this settings pane, we can load TextMate plugins by clicking the green +. We can then specify the path to the bundle we've just cloned.


Once selected, PhpStorm will list the TextMate bundle we've just loaded. We can use the checkbox to enable or disable the bundle in our IDE. At the bottom, we can configure color schemes. TextMate has various color schemes which PhpStorm can mimic.


Most TextMate bundles come with a set of file extensions they can handle. The shellscript bundle registers common extensions such as .sh, .bash, .zsh and so on. If not or if we want to make use of another file extension which maps to the TextMate bundle, we can add extensions under the IDE settings File Types preferences, adding the extension to the Files supported viaTextMate bundles.


Putting it to the test

Once a TextMate bundle is added, PhpStorm will provide syntax highlighting for the file types registered with the bundle. Here's a sample shell script which uses the shell script TextMate bundle we cloned earlier:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.