Sublime Forum

Auto switch curly brackets to do end in ruby

#1

In ruby, we use “{…}” for single-line blocks, “do end” for multi-line blocks.

Sublime’s snippet is great, but only support “{…}”, when i need write multi-line blocks, have to switch to “do end” by myself. What i need is select “{” or just change mouse focus left to “{” and type “do” then type “tab” trigger to change “{…}” to “do end” and remain the code between “{…}”.

Another relatively function is supporting do end block snippet.

Is that possible right now or plan to add this function. It’s very useful for rubyist.

Thanks for help.

0 Likes

#2

Does this means that you want an do-end-snippet?
Why don’t you create some then?
As you can read in the doc ( sublimetext.info/docs/en/extensi … ppets.html ) you can click on
“Tools -> New Snippet”

write something like

[code]

do

source.ruby
[/code]
Save this in the Sublime-Folder in Packages/User/ and restart.

Edit: I just saw that you also can type dob and then [tab] ( viewtopic.php?f=3&t=1338&p=6008&hilit=ruby#p6008 ).

0 Likes