PyCharm 2024.2 Help

TextMate

TextMate is a general-purpose GUI text editor for macOS.

For a number of languages that are not supported in PyCharm, for example, Swift, C++, and Perl, the IDE still provides syntax highlighting to improve your coding experience if you occasionally need to examine such code.

Syntax highlighting for these languages is based on TextMate grammars, and PyCharm is shipped with a collection of grammar files for different languages. All the available bundles are listed on the Editor | TextMate Bundles page of the Settings dialog (Ctrl+Alt+S) .

Enable the TextMate Bundles plugin

This functionality relies on the TextMate Bundles plugin, which is bundled and enabled in PyCharm by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the TextMate Bundles plugin, and select the checkbox next to the plugin name.

Import TextMate bundles

You can also download and use custom TextMate bundles for other languages. PyCharm provides compatibility with several types of bundles, originally designed for different editors:

  • TextMate bundles are the original bundle types for TextMate editor. They are packaged in a directory with a .tmBundle extension.

  • Sublime Text packages come with .tmLanguage and .tmPreferences files inside a directory. Since the original TextMate bundles also contain the same files, they are often used interchangeably.

  • Visual Studio Code extensions with a package.json file present in the directory.

Suppose you want PyCharm to highlight syntax of the OCaml files.

  1. Download the OCaml TextMate Bundle. It is now on your disk.

  2. Press Ctrl+Alt+S to open settings and then select Editor | TextMate Bundles.

  3. Click the Add button and locate the OCaml bundle on your disk. It appears in the list of recognized bundles.

Adding a custom TextMate Bundles in the IDE settings

Test the imported bundles

Once a TextMate bundle is added, PyCharm provides syntax highlighting for the file types supported by this bundle. Here is a sample OCaml code fragment that uses the TextMate bundle added earlier:

Add TextMate bundles
Last modified: 10 September 2024