Home Download Buy Blog Forum Support

Block Nav: Like CTRL+M for braceless langs like Ruby, Python

Block Nav: Like CTRL+M for braceless langs like Ruby, Python

Postby JMM on Mon Feb 20, 2012 9:53 pm

I couldn't find something before, so I created a plugin to assist with navigating block structures in "braceless" languages like Ruby and Python via key binding. E.g.

Code: Select all
def
end

do
end

begin
[rescue]
end

if
[elsif]
[else]
end


The plugin allows jumping from something like `do` to `end` and vice versa via key combo. Or jumping out to the start of a block (e.g. `def` | `if` | `elsif` | `else`) from a line inside the block.

It relies on code being well indented and not mixing tabs and spaces. It's a bit rough, but functioning.
JMM
 
Posts: 9
Joined: Fri Feb 03, 2012 1:23 pm
Location: Portsmouth NH

Re: Block Nav: Like CTRL+M for braceless langs like Ruby, Python

Postby jbrooksuk on Mon Feb 20, 2012 11:10 pm

Ooft! If I can modify this to work with PHP (the language I use daily) this will be handy for me.
jbrooksuk
 
Posts: 782
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Block Nav: Like CTRL+M for braceless langs like Ruby, Python

Postby JMM on Tue Feb 21, 2012 12:31 am

If your code is well indented then you should be able to use it as-is if you want to be able to jump out of the middle of a block to find the beginning in PHP. But that's all it would really add, since in PHP you have curly braces around blocks that you can do bracket matching on to move between the start and end. This plugin is an attempt to compenstate for the absence of those braces around blocks in languages like Ruby and Python and allow you to do something like the bracket matching that's already possible with PHP.
JMM
 
Posts: 9
Joined: Fri Feb 03, 2012 1:23 pm
Location: Portsmouth NH


Return to Plugin Announcements

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 7 guests