Convert Ruby blocks between single line and multi line formats. Or between curly brackets and do-end statements.
Place the cursor in between the brackets and hit the shortcut.
macOS | Linux/Win | |
---|---|---|
Normal | ctrl-} |
alt-] |
Without joining | ctrl-alt-} |
alt-} |
Place the cursor in between the do-end and hit the shortcut.
macOS | Linux/Win | |
---|---|---|
Normal | ctrl-{ |
alt-[ |
Without collapse | ctrl-alt-{ |
alt-{ |
- Hashes and string interpolation are ignored
- RSpec blocks are honored.
- There are separate commands if you don't want the block to collapse or join
- It looks for the first starting block on the current line, then up. Upon success, it looks right, then down for a matching } or end.
- When there is a block with only one line of code: the curly converter will join the block onto one line; the do-end converter will separate the three lines and then auto-tab.
- It will only try up or down 6 lines, but this configurable in your settings.
'ruby-block-converter:to-curly-brackets'
'ruby-block-converter:to-curly-brackets-without-collapse'
'ruby-block-converter:to-do-end'
'ruby-block-converter:to-do-end-without-join'
- Version 4.0.0 introduces changes to the macOS keymaps
Inspired by the Sublime Text Ruby Block Converter by irohiroki.