Features Tips & Tricks Tutorials

Feature Spotlight: TextMate bundles in PyCharm

Happy Friday everyone,

Today I’m going to shed some light on how to get syntax highlighting for unsupported languages and file types in PyCharm.

As you probably know, PyCharm supports only a limited number of languages and technologies. PyCharm supports them with intelligence that appears in code completion, smart navigation, refactorings, inspections, and suggestions. But sometimes you might need to edit some project-specific files of an unsupported file type. In PyCharm you can open any file and edit it right away, but it always helpful to get at least syntax highlighting for it. Thanks to the TextMate bundles support you can get syntax highlighting for a wide range of languages.

Let’s see how to enable highlighting for an unsupported language in PyCharm. For example, in your project you might have some shell scripts – PyCharm doesn’t support the Shell language by default, however there is a TextMate bundle available for it:

shell

Here is a few simple steps you take to enable the highlighting for the Shell language inside PyCharm:

1. First go to Settings (Preferences for Mac OS) and make sure that the “TextMate bundles support” plugin is installed and enabled:

plugin

2. Download a TextMate bundle. In my example I use the shellscript TextMate bundle from the official TextMate GitHub repo.
3. Open Settings again and go to Editor | TextMate Bundles:

settings

4. Click “+” and locate the bundle on your filesystem. After that the bundle appears in the list of recognized bundles:

selected

5. From this point you just need to click OK and enjoy the new syntax highlighting in the editor:

colored

That’s it! However, lets hold for a while and consider some additional settings you might want to adjust.
The first thing you’ll probably want to change is a syntax coloring scheme. This can be done in Settings | Editior | Textmate Bundles:

colorscheme

The second thing you’ll probably need is to adjust file types associations. For that go to Settings | Editor | File Types and choose the “Files supported via TextMate bundles” option.
Here you can modify the list of registered filename patterns and the ones that are ignored:

filetypes

Hope this post helps!
See you next week.

-Dmitry

image description