By jcroll

2013-05-08 22:34:57 8 Comments

I found this but honestly not sure how to install it or whether it applies. Thanks!


@CrazyCoder 2013-05-08 23:16:40

Ruby plug-in that you have linked is designed for IntelliJ IDEA Ultimate only, it will not work with PhpStorm. See this answer for more details.

However, it's possible to get the basic syntax highlighting for Ruby files in PhpStorm using the TextMate bundles support plug-in. It's already included with PhpStorm 6.0.1 and you don't need to install it, just make sure it's enabled in Settings | Plugins.

  1. Git clone Ruby.tmbundle into some directory.

  2. Add this directory in Settings | TextMate Bundles:

Ruby bundle

For some reason PhpStorm TextMate Bundles support will not recognize *.rb files as supported by this bundle. To fix this problem open Ruby.tmbundle\Syntaxes\Ruby.plist file in some text editor, find <key>fileTypes</key> section, add <string>rb</string> under <array>

(the above should be fixed in the latest Ruby bundle version, so the editing the bundle is no longer needed, but if you are adding some other language bundle, it's something you may need to adjust)

Restart PhpStorm, verify that *.rb is now associated correctly:


Now you get Ruby syntax highlighting in PhpStorm:

Ruby syntax

If you need full support for both Ruby and PHP (plus much more) in a single IDE, consider using IntelliJ IDEA Ultimate.

@jcroll 2013-05-09 01:45:14

Fantastic thank you!!

@JackMahoney 2013-06-06 02:13:29

Wish I'd known about IDEA Ultimate's capabilities before buying PHPStorm and RubyMine separately!

@CrazyCoder 2013-06-06 07:19:10

@JackMahoney buying separate products has its benefits, you get new features faster than in IDEA plug-ins and interface is less flooded with unrelated options, see also this answer.

@Ascherer 2013-06-10 16:22:54

Not to mention, the size/memory footprint of having the ultimate one

@Matt Humphrey 2013-06-20 10:44:48

@JackMahoney I've bought both too, but I think separate products are much better. I can't imagine that you'd be working on a Ruby and PHP project at the same time.

@Populus 2014-01-30 16:39:12

This doesn't work in windows as a large number of the filenames are invalid in windows systems

@CrazyCoder 2014-04-24 13:08:22

@Populus thanks for the pointer, I've updated the answer with your link.

@hgcrpd 2014-05-11 04:23:30

@Populus using the official repo still gives me filename problems on Windows. How did you guys solve this?

@Populus 2014-05-11 04:57:48

@hgcrpd I used Intellij Idea Ultimate.

@hgcrpd 2014-05-11 07:34:33

So in other words this doesn't work in windows because the textmate bundles have invalid windows filenames?

@Mike T 2014-10-02 00:04:33

This approach works with RubyMine too (and probably the other JetBrains IDEs). I added the Python bundle to RubyMine.

@abbood 2014-11-21 11:23:13

ok @CrazyCoder any idea how to view python scripts in php storm?

@DutGRIFF 2015-04-18 15:17:45

Does anyone else get a white background behind the text? I am using PHPStorm for Mac. My background is grey but the ruby file uses white until it is the selected line.

@Scott Yang 2015-05-31 08:58:56

Thank you! Working almost perfectly on Windows 7 on PhpStorm - had to change my current custom dark theme's gray to #2C2C2C to get consistent bgcolor to match RailsCast theme. @DutGRIFF You have to change TextMate Color Scheme in Settings - Editor - Code Style - TextMate Bundles.

@Sam 2015-06-17 07:35:34

I also added <string>Vagrantfile</string> into Syntaxes\Ruby.plist to get syntax highlighting for Vagrantfiles.

@Jimbo 2015-07-06 20:04:35

I'm using the Darkula theme. For me, all of the whitespace was bright white and the highlighting was just awful.

@Liam Potter 2015-09-14 09:33:33

@jimbo you need to set the colour scheme under the textmate bundle plugin options. Preferences/Settings > Editor > TextMate Bundles, then you will see there is a listing of colour schemes with ide schemes on the left and textmate on the right, you can match up darcula to use darcula there.

@Jörn 2016-04-17 22:21:56

@Sam i've added # -*- mode: ruby -*- (\n<-replace this with a new line) # vi: set ft=ruby : to the top of my vagrantfile which works too.

@Jörn 2016-04-17 22:23:32

Works in Webstorm too!

@MrE 2016-06-17 17:55:25

Do you know of a way to get the auto-indent to work as well? (i.e. in python language if you use CMD+A to select all, then CMD + Option + L, it auto indents the code) It doesn't work with the Ruby files.

@Gabor Garami 2016-10-10 13:24:40

@CrazyCoder Ruby.tmbundler fixed the rb extension issue, editing the Syntaxes/Ruby.plist is not required anymore. Could you update your answer with this information?

@Eric Keyte 2016-12-13 16:44:52

For those of you on 2016.3, you can map themes to Darcula right in the TextMate Bundles screen. It's no longer in "Editor".

@Populus 2014-01-30 16:43:57

CrazyCoder's git repo doesn't work in windows systems, as a large number of the filenames are invalid in Windows.

I have, however, found the official repo for ruby for textmate:

@fazy 2014-06-06 08:48:05

Using Windows, worked for me, thanks! File -> Settings -> Textmate Bundles. Click + (top right), select local clone of ruby.tmbundle. Click OK. Didn't even need to restart PHPStorm.

@Adam Patterson 2013-08-29 22:45:18

I actually copied over my PhpStorm theme to RubyMine with no issue, so it should go both ways.

I went as far as to create a TextMate keymap for PhpStorm as well, you can take a look here:

Related Questions

Sponsored Content

25 Answered Questions

[SOLVED] Check if a value exists in an array in Ruby

  • 2009-12-31 17:49:03
  • user211662
  • 745400 View
  • 1201 Score
  • 25 Answer
  • Tags:   ruby arrays

23 Answered Questions

[SOLVED] How to write a switch statement in Ruby

7 Answered Questions

[SOLVED] How does PHP 'foreach' actually work?

8 Answered Questions

[SOLVED] How to convert a string to lower or upper case in Ruby

19 Answered Questions

[SOLVED] What is attr_accessor in Ruby?

  • 2010-12-06 21:07:06
  • dennismonsewicz
  • 421570 View
  • 943 Score
  • 19 Answer
  • Tags:   ruby

18 Answered Questions

[SOLVED] How to get a random number in Ruby

31 Answered Questions

[SOLVED] How do I get a YouTube video thumbnail from the YouTube API?

33 Answered Questions

[SOLVED] How do I get the current absolute URL in Ruby on Rails?

6 Answered Questions

[SOLVED] How to install a specific version of a ruby gem?

  • 2013-06-10 14:37:15
  • mjs
  • 352060 View
  • 765 Score
  • 6 Answer
  • Tags:   ruby gem

9 Answered Questions

[SOLVED] How to check whether a string contains a substring in Ruby?

  • 2011-11-24 14:21:15
  • BSalunke
  • 630270 View
  • 647 Score
  • 9 Answer
  • Tags:   ruby string

Sponsored Content