jEdit for ruby/rails development

I was recently reading through my feeds when I came across the following post. Akshay was musing over how great jEdit is for ruby/rails development.

I totally agree with him so I commented on his post and while writing the comment I decided it was high time to write my own article on using jEdit for ruby/rails development.

I first found jEdit about 6 to 7 years ago and ever since then it’s been my number one programmers editor. I’d dabbled with ide’s like eclipse and intellij for java development but always in combination with jEdit for web work.

Ever since I switched to ruby/rails development I’ve found that jEdit adapted extremely well and thanks to Rob Mckinnon’s Ruby plug-in for jEdit , all the more so.

jEdit is a programmers editor written by Slava Pestov (author of the Factor language) in java. I’m not going to go into details about what jEdit is and isn’t. I’m just going to go over how I use jEdit for my rails development and why I think it’s a great development environment for rails work on any platform.

It comes with edit modes (syntax highlighting) for over a hundred different languages (ruby,(x)html,css,javascript,yaml etc…). Writing your own is not that difficult if you find you have to. I’ve written a couple myself (For the velocity templating engine and the TADS language) In fact I’m thinking about writing one for rhtml soon ;) I currently have rhtml set up as html mode.

jEdit also has a very powerful macro system based on beanshell (macros can be written in ruby, python or any bsf scripting language thanks to the superscript plug-in). i.e. you can hook in ruby/rake calls.

One of the main features I love about this editor is practically everything has a configurable key shortcut which means I very rarely have to touch the mouse at all and that saves on a lot of time.

The shortcuts menu option…

It has a very modular structure allowing you to lazy load in a very large number of plug-ins, available here or via jEdit itself via the Plugin Manager (Recommended – For those stuck behind a corporate firewall,

APS comes in handy).

(Only loaded on first use).

very handy for ruby development. He then decided to tie them all together into a plug-in.

You can also have it as a quick pop-up…

if you have the rdocs tab open it’ll also automatically point to the documentation of the method you’ve currently selected.

syntax error in your ruby code.

typed and indented for you. documentation included as well. You can esily search ri with a quick shortcut.

have an “Introduce variable refactoring” which I don’t use myself but it’s a start.

for all it’s edit modes.

migrations, just like DHH uses) available here

(docked in at the bottom).

very handy. This in combination with the rectangular selection (column insert) mode and the clipboard history makes for very powerful editing.

jEdit written to cover many different needs. Macros are quick and easy way to extend jEdit’s functionality without having to write a full-blown plug-in (in java). As I mentioned you can write your macros in ruby and each macro can be assigned a shortcut. If you find you’re missing functionality that XXX editor you used before had, chances are someone’s gone ahead and written a macro for it. If not you can write it yourself or ask someone in the large jEdit community to do it for you (if they happen to feel like it and you ask nicely). I forgot to mention that you can download macros from the community from within jEdit itself via the MacroManager plug-in (you’ll find a few I’ve written myself up there).

Let me tell you that there was a time when jvm’s were quite laggy but not anymore. I run jEdit using sun’s 1.5 jvm. I start it with the following command:

Java and performance

Quite a few people out there complain about how java apps are low-performant.

java -mx64m -jar /usr/local/share/jedit/4.3pre2/jedit.jar -background -nogui &

This is added to my fluxbox init file, so that jedit is started up in the background every time I restart X. I’ve assigned the ‘e’ alias to the following startup command:

jedit -reuseview

So whenever I want to start editing a file, there is no startup lag at all.

Right,

I’ll leave you with a final screen shot of jedit split into 4 screens working on a few different kinds of rails files. I’m using the “profont” font and a custom jedit editor colour scheme that is similar to the Vibrant Ink textmate theme.


Torna a articles