Prevent RubyMine from reformatting pasted code

When you paste copied code with CTRL+V, RubyMine will change the indentation of the pasted code. You can prevent this by pasting with CTRL+ALT+Shift+V instead ("Paste Simple").

To change this behavior entirely, you can open your settings and navigate to Editor / General / Smart Keys. Here you can select one of three options for Reformat on paste:

  • None
  • Indent Each Line (default)
  • Indent Block
  • Reformat Block

You might want to try "Indent Block".

How to fix: RubyMine occasionally no longer accepts keyboard input

From time to time, RubyMine suddenly did not accept any keyboard input and felt crashed, while mouse interaction was still possible. This apparently happens to all IntelliJ IDEs, especially on Ubuntu 14.04.

I've managed to fix it by having a shell script that exports XMODIFIERS="" when launching RubyMine, like this:

XMODIFIERS= /home/arne/rubymine/bin/

It has been working reliably for me ever since, at least until RubyMine 8.

An alternate solution suggested on the [Jetbrains issue tracker](https://youtrack….

List of Helpful RubyMine Shortcuts

Search for any symbol in your application, like CSS classes, Ruby classes, methods, helpers etc.
Search for filename in your application (also dependencies)
Open a list of recently opened files
Open a the navigation bar as a context menu. Allows you to quickly navigate between files.


Find and execute a menu actio…

Faster debugging with RubyMine macros

In my RubyMine I have recorded two macros for debugging and linked them to some keyboard shortcuts. Since I believe everyone could benefit from having those I wanted to share this.

The first one simply inserts


and the second one

.tap { |object| binding.pry }

for when you do not have a reference to the object you want to inspect.

In order to record a macro you simply follow the path Edit > Macros > Start Macro Recording.

Then you simply type binding.pry or whatever you want to record and stop recor…

Linked content

Ubuntu: Make Ctrl-Space work in RubyMine, Emacs, or other tools

I was annoyed that RubyMine's autocompletion did not work via Ctrl+Space for me. In fact, it did not work in any application.

Turns out that keyboard combination was hijacked by Ubuntu as it's the default for switching input languages (i.e. keyboard layouts). If you use only 1 language/layout, you will not notice except for the key not working.

To fix it, do the following:

  1. Run ibus-setup (e.g. from a terminal). This will open a GUI dialog.
  2. In the 1st tab you should see "Next Input Method" followed by "<Control>space".
  3. Click t…

Rubymine: Code folding

Code folding is a very useful feature to me. It gives me a quick overview over a file and keeps me from scolling like a hamster in its wheel.

Keyboard shortcuts:

Collapse/expand current code block
strg -/+
Collapse/expand the whole file
strg ctrl -/+

When diving into Cucumber features or huge Ruby classes, I usually collapse all and the gradually expand what I need.

Debug Ruby code

This is an awesome gadget in your toolbox, even if your test coverage is great.

  • gem install ruby-debug (Ruby 1.8) or gem install debugger (Ruby 1.9)
  • Start your server with script/server --debugger
  • Set a breakpoint by invoking debugger anywhere in your code
  • Open your application in the browser and run the code path that crosses the breakpoint
  • Once you reach the breakpoint, the page loading will seem to "hang".
  • Switch to the shell you started the server with. That shell will be running an irb session where you can step thr…

Rubymine 7: Howto disable backspace deletes lines instead of whitespaces

RubyMine 7.1:

Settings -> Editor -> General -> Smart Keys -> Unindent -> To nearest indent position

RubyMine 7.0:

Settings -> Editor -> General -> Smart Keys -> Backspace smart indent -> uncheck

The new Modularity 2 syntax

We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically.

There is no does method anymore

We now use traits with the vanilla include method:

class Article < ActiveRecord::Base
  include DoesTrashable

When your trait has parameters, use square brackets:

class Article < ActiveRecord::Base
  include DoesStripFields[:name, :brand]

Note how you…

Rubymine >= supports keybinding for "Goto next/previous splitter"

Rubymine supports keybinding to switch panes by hotkey like awesome window manager users are used to.

Type "splitter" in the top right keymap section search field (not the global settings search).

Note: A splitter is what you get after using split vertically or split horizontally.

How to not repeat yourself in Cucumber scenarios

It is good programming practice to Don't Repeat Yourself (or DRY). In Ruby on Rails we keep our code DRY by sharing behavior by using inheritance, modules, traits or partials.

When you reuse behavior you want to reuse tests as well. You are probably already reusing examples in unit tests. Unfortunately it is much harder to reuse code when writing integration tests with Cucumber, where you need t…

RubyMine detects syntax errors where there are none

To make this go away I had to wipe my RubyMine settings (~/.RubyMine) and configure everything again. Fun.

When RubyMine doesn't show you Git blames / annotate gutter not available

  • You probably haven't configured version control for your project.
  • Go to Project Settings / Version Control and set the director <Project> to Git
Linked content

daylerees/colour-schemes · GitHub

Awesome color schemes for RubyMine, Sublime Text 2 and other editors.

To install the themes into your Rubymine, copy intellij-themes/*.xml from the repository to your local ~/.RubyMine40/config/colors. Then restart RubyMine.


How to not leave trailing whitespace (using your editor or Git)

There is no reason to leave trailing whitespace characters in your project's files, so don't add any.

A git diff --check will tell you if there are any and you should not commit when you see them. So go ahead and switch your editor/IDE to automatically remove them for you.
Below are a few instructions on how to get them removed by your favorite IDE or editor.

Note that except for RubyMine, the following changes will remove trailing white-space on all lines, not only those that you changed.
While this should not be a problem if your proje…

Linked content

RubyMine: Accessing views and partials from controllers

You can quickly access views that belong to a controller by using the tiny "page with arrow" icon in the gutter: icon

Access a method's view file

Click the icon next to the method definition in the controller.

If a view file does not yet exist, RubyMine will prompt you for its filename.

All views & partials associated to a controller

For a list of all views and partials that belong to the current …

Linked content

RubyMine 4.5.1: Sass/SCSS Support Improvements

A number of issues concerning Sass/SCSS autocompletion and syntax highlighting were submitted as a feedback for RubyMine 4.5. Web development with Rails can’t do without Sass/SCSS code writing so we’ve decided to fix the most annoying bugs as soon as possible.

This website uses cookies to improve usability and analyze traffic.
Accept or learn more