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.
Related cards:
RubyMine: Adjust Code Templates
tl;dr
To adjust code templates in RubyMine, navigate to Settings -> Editor -> File and Code Templates.
Example
You can navigate to the test file of the currently open file with the shortcut Ctrl + T
. If no test file exi...
Disable automatic code suggestions in RubyMine
To disable the mostly useless automatic suggestion popups in RubyMine, go to File / Settings, then to Editor / General / Code Completion and uncheck Auto-display code completion.
You can still open the popup by pressing CTRL + Space
. And ...
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 ...
RubyMine: Fixing "Rubocop returned exit code -1. See the logs for details"
When RubyMine reports Rubocop returning "exit code -1", upgrading Rubocop can be the fix:
gem install rubocop
"The logs" can be accessed with Ctrl + Shift + A > Show log in (Files). This opens your file manager at the IDEA log location; t...
List of Helpful RubyMine Shortcuts
Navigation
CTRL + SHIFT + ALT + N
-
Search for any symbol in your application, like CSS classes, Ruby classes, methods, helpers etc.
CTRL + SHIFT + N
-
Search for filename in your application (also dependencies)
CTRL + E
-
O...
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) orgem install debugger
(Ruby 1.9) - Start your server with
script/server --debugger
- Set a breakpoint by invoking `debugge...
RubyMine / IntelliJ: How to increase UI and fonts for presentations
When giving a presentation where you do some coding, the font size you usually use is probably a bit too small and makes code hard to read for users on smaller screens or low-bandwidth connections when the image quality is lower.
Here are two sol...
RubyMine: Better soft wraps
Sometimes your code has long lines:
describe 'foo' do
describe 'bar' do
really_long_line_really_long_line_really_long_line
another_line
When you're working with multiple editor panes, such code will often be wider than the pane...
RubyMine: Real-time Collaborating in the IDE
RubyMine has a collaboration feature called "Code With Me". Using it, you can invite someone into your local editor to work together. This is nicer to the eyes and much more powerful than sharing code through some video chat.
How to
Getting s...
How to: Context-dependent word expansion in RubyMine
One of the many useful features of TextMate is autocompletion of words. If I were in TextMate right now, I could write "au[tab]", and it would complete it to "autocompletion". RubyMine can do this, too. When you write a word (e.g. a variable name)...