RubyMine knows most of the proper formatting, and is pretty good at matching up Ruby or HTML (it sometimes gets confused with embedded Ruby, though). It’s quite a tedious process to check for these. Sometimes after editing our code, we end up with extra tabs, extra spaces, or not enough of either. I usually just delete the = when I need to. This will provide you with the visible form of embedded Ruby. This gets tedious, especially since % is not a commonly used key. This means you have to type around every line that you write. When you are writing code in a Ruby on Rails application, you have to sandwich any Ruby code that you write in a view with embedded Ruby tags. You can continue this mode, for instance, pressing Command + Left Arrow will position all the cursors on the far left. This will vertically align all the cursors together. Alternatively, click and drag the lines to add the cursors. Now, when you type, it will edit all of those areas of code together. Click the positions where you would like to add more cursors. Then, hold down Option (yes, one of the lesser-used keys). Set the cursor in the first desired position. We can set the cursor to edit the code in many places all at once. Maybe we changed our mind about a certain style, or we need to add a method in a few places. Occasionally, we need to change many areas of code at the same time. This effectively outdents the block of code, moving it closer to the left.Įditing Code in Multiple Places Simultaneously If you want to do the opposite, remove tabs, press Shift + Tab instead. In Markdown, this is useful if you want to show code in a prettier way. In Ruby programs, this is useful if you are adding in more nested code, such as if then statements. It adds the tabs to each of the lines of code, which indents all of it. When you select multiple lines of code and press Tab, the program already knows that you don’t wish to replace your neat code with a couple tabs. You could use the next shortcut, but RubyMine has an easier way. Sometimes, you wish to add indentation to a block of code. This keeps your auto-completed characters and lets you continue coding on the following line. The best shortcut for this situation, however, is to press Shift + Return. What if you want to keep those quotes, but just write on the following line? You could click, you could use the arrow keys. When you want to go to the next line, and keep typing, this autocomplete feature may get annoying, because if you hit Return, it puts your nice right parenthesis or double quote on the next line. This saves errors sometimes, because you may forget. You can type it to end it if you want, and your cursor is moved to the other side. When you start a string, a parenthetical, or an interpolation, it knows that you need to eventually end it, and it automatically places the ending character right after your cursor. RubyMine already has a shortcut built in. This shortcut will toggle the comments on and off, so if you wish to switch it back, use the same combination. However, the faster way is to select all the lines of code that you wish to convert, and press Command + /. If you have some code in RubyMine that you wish to turn into comments, the hard way would be to position the cursor at the beginning of each line of code and then insert an octothorpe. For those just joining us, it seems like the biggest things RubyMine brings to the table are:įeelings are overwhelmingly positive but the strongest argument against it is that Vim is more flexible.In order to save time, use these shortcuts in RubyMine. Is it worth it? Has anyone made the switch from to RubyMine? What were the killer features that really sold you? Any tips that you think might make the transition easier? On the flipside, has anyone switched away from RubyMine and if so, why? I know that these are all things I can work around and there's obviously going to be a learning curve when making such a big change, but I'm not sold that this is all worth the time. It's a lot of little things, but I think most of them are frustration with their defaults, missing plugins I've added to Sublime, and a lack of a resources when I have questions. It seems cool, there's a lot that I like in theory, but I'm having a very hard time switching away from Sublime Text 2.
0 Comments
Leave a Reply. |