# jEdit can run code like TextMate does?

**URL:** <https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858>\
**Category:** Ruby\
**Created:** [September 18, 2007, 9:51am UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858 "2007-09-18T09:51:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 18, 2007, 9:51am UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/1 "2007-09-18T09:51:58Z")

</div>

I am using jEdit on windows for Ruby, and it seems to lack a function to  
run code by popping up a new window. (by pressing F5 like in IDLE for  
Python, or %-R for mac using TextMate). The result window on TextMate  
looks really good by the way.

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 19, 2007, 8:17pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/2 "2007-09-19T20:17:49Z")

</div>

SpringFlowers AutumnMoon a Ã©crit :

> I am using jEdit on windows for Ruby, and it seems to lack a function to  
> run code by popping up a new window. (by pressing F5 like in IDLE for  
> Python, or %-R for mac using TextMate). The result window on TextMate  
> looks really good by the way.  
> Sure you can, You need to configure the Console plugin to dislay the  
> “commando” buttons, one of them is Ruby, it’ll start a simple non-ansi  
> terminal emulation window displaying the output of the interpretation of  
> the current buffer. Non-ansi means you cannot run “curses” kind of  
> programs.

J-P

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 20, 2007, 1:05pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/3 "2007-09-20T13:05:53Z")

</div>

On Sep 19, 11:12 am, Jaypee [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> SpringFlowers AutumnMoon a écrit :\> I am usingjEditon windows for Ruby, and it seems to lack a function to
> 
> > run code by popping up a new window. (by pressing F5 like in IDLE for  
> > Python, or %-R for mac using TextMate). The result window on TextMate  
> > looks really good by the way.
> 
> Sure you can, You need to configure the Console plugin to dislay the  
> “commando” buttons, one of them is Ruby, it’ll start a simple non-ansi  
> terminal emulation window displaying the output of the interpretation of  
> the current buffer. Non-ansi means you cannot run “curses” kind of programs.

that’s weird… do I just go to jEdit → Plugins → Plugin Manager →   
Install ?  
there is no Console plugin there…

and then it seems like I have to download a third party plugin Console

[http://plugins.jedit.org/plugins/?Console](http://plugins.jedit.org/plugins/?Console)

so i downloaded the Console 4.1.2 plugin and jEdit started up saying  
Plugin error, it needs 1.3.3?

and i downloaded the Console 4.3.3 plugin instead, and again jEdit  
started up saying my jEdit is 4.2final and won’t work with it.

it is a simple thing…

any simpler way?

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 20, 2007, 1:44pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/4 "2007-09-20T13:44:00Z")

</div>

> and i downloaded the Console 4.3.3 plugin instead, and again jEdit  
> started up saying my jEdit is 4.2final and won’t work with it.

Hmmmm… For me (jEdit 4.3pre9), the plugin manager _does_ list the  
Console plugin  
(and I have installed it). Now I don’t know much about the history  
of jEdit - you are using an old version, and maybe the plugin manager  
does not find a Console compatible with your jEdit. This would also  
explain why you couldn’t install it manually.

Would upgrading jEdit to the actual version be an option for you?

Otherwise maybe you will be helped better in the jEdit mailing  
list ([jedit-users List Signup and Options](https://lists.sourceforge.net/lists/listinfo/jedit-users))

Ronald

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 21, 2007, 9:38am UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/5 "2007-09-21T09:38:23Z")

</div>

Jaypee wrote:

> SpringFlowers AutumnMoon a Ã©crit :
> 
> > I am using jEdit on windows for Ruby, and it seems to lack a function to  
> > run code by popping up a new window. (by pressing F5 like in IDLE for  
> > Python, or %-R for mac using TextMate). The result window on TextMate  
> > looks really good by the way.
> 
> Sure you can, You need to configure the Console plugin to dislay the  
> “commando” buttons, one of them is Ruby, it’ll start a simple non-ansi  
> terminal emulation window displaying the output of the interpretation of  
> the current buffer. Non-ansi means you cannot run “curses” kind of  
> programs.

finally it installed after getting the “errorlist” plug-in…  
but the Plugins -\> Console -\> Commando  
doesn’t have any Ruby choice.

I even downloaded the Ruby plugin, still not there…

wow… it is more complicated than learning the Singleton pattern.

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 21, 2007, 2:55pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/6 "2007-09-21T14:55:50Z")

</div>

Hello AutumnMoon,

it’s long ago, I wrote this instruction originally for VHDL. Hope it  
helps.  
I’m using jEdit 4.3pre9 with Ruby, on Windows, and I like it very  
much.  
On my side it works like you would have it working, so there is a way  
to get it done.

Kind regards,

Axel

# Execute a RUBY-file from within jEdit

If you want to execute a RUBY-file from within  
jEdit by just pressing for example “F5”, you can try:

Edit the file “…\macros\Misc\Run\_Script.bsh” as follows:

Behind: path = buffer.getPath() + " ";  
Add: bufferDir = dirname( buffer.getPath() );

Behind:  
else if(mode.equals(“python”)) {  
execScript(“python”, "python " + path);  
}

Add:  
else if(mode.equals(“ruby”)) {  
execScript(“ruby”, "ruby -w " + path);  
// -w -\> warnings  
}

In jEdit: Utilities \> Global Options \> Edit Shortcuts: “Macros”

> Command: “Run Script” \> Click into the field "Alternative

Shortcuts" \> Press the F5-Button \> OK \> OK

Optional, but very handy: Install the Plugin “ErrorList” and the  
Plugin “Console”.

It might be worth adjusting:  
jEdit \> Plugins \> Plugins Options… \> Console \> Error  
Patterns \> Ruby \>

Name: Ruby  
Regexp: (\s+from)?\s\*(.:[^:]+)\s\*:(\d+):?(.\*)  
Warning regexp: leave empty  
Extra lines regexp: leave empty  
Filename: $2  
Line number: $3  
Error message: $4

Test Area (not in jEdit 4.2):  
K:/SyncByFlash\_WIP/syncbyflash/tmp002.rb :25:in `m21': undefined method`opne’ for FileUtils:Module (NoMethodError)  
from K:/SyncByFlash\_WIP/syncbyflash/tmp002.rb :16:in `m2' from K:/SyncByFlash_WIP/syncbyflash/tmp002.rb :11:in`m1’  
from K:/SyncByFlash\_WIP/syncbyflash/tmp002.rb :30  
Process ruby exited with code 0

Press Test/Commit (not in jEdit 4.2)

> OK \> OK

When now pressing “F5” on an open RUBY-file, it will be executed;  
Errors are shown by the ErrorList-Plugin, and when clicking  
on those errors, jEdit jumps to the relevant line in the sourcecode.

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 22, 2007, 12:40pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/7 "2007-09-22T12:40:54Z")

</div>

My previous post seems to be lost :(.

The following instruction is quite old, and I’m not sure if  
everything is up to date. I’m using jEdit for Ruby-editing  
a lot and like it very much (I’m on Windows). And what you  
ask for, works for me, both on jEdit 4.2 and 4.3pre9.  
Please ask again, if the following Instruction does not  
lead to success.

Kind regards,

Axel

# Running Ruby from within jEdit

If you want to run a Ruby-file from within  
jEdit by just pressing for example “F5”, you can try:

Edit the file Run\_Script.bsh" as follows:  
(You will find it here:  
In jEdit goto Utilies \> jEdit Home Directory \>  
Macros \> Misc \> Run\_Script.bsh )

Behind: path = buffer.getPath() + " ";  
Add: bufferDir = dirname( buffer.getPath() );

Behind:  
else if(mode.equals(“python”)) {  
execScript(“python”, "python " + path);  
}

Add:

else if(mode.equals(“ruby”)) {  
execScript(“ruby”, "ruby -w " + path);  
// or without showing warnings:  
// execScript(“ruby”, "ruby " + path);  
}

In jEdit: Utilities \> Global Options \> Edit Shortcuts:  
“Macros” \> Command: “Run Script” \> Click into the field  
"Alternative

Shortcuts" \> Press the F5-Button \> OK \> OK

When now pressing “F5” on an open Ruby-file, it will/should be  
executed; of course, you must have Ruby installed;

OPTIONAL, but very handy: Install the Plugin “ErrorList”  
and the Plugin “Console”.

If You choose to do so, maybe you want to adjust the “Error  
patterns”; but try first without changing them, because  
even my “Error patterns” are not perfect. (Does anybody  
have a better set of error patterns for Ruby??):

jEdit \> Plugins \> Plugins Options… \> Console \>  
Error Patterns \> Ruby \>

Name: Ruby  
Regexp: \s+from\s(.:[^:]+)\s\*:(\d+):?(.\*)  
Warning regexp: leave empty  
Extra lines regexp: leave empty  
Filename: $1  
Line number: $2  
Error message: \<-- from here. $3

(On jEdit 4.3, not jEdit 4.2. you must enter a test string  
and press a test/check(?) - button now.)

Now: \> OK \> OK

When now pressing “F5” on an open Ruby-file, it will be  
executed; of course, you must have Ruby installed; Errors  
are shown by the ErrorList-Plugin, and when clicking on  
those errors, jEdit jumps to the relevant line in the  
sourcecode.

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 22, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/8 "2007-09-22T18:00:27Z")

</div>

Gavin K. wrote:

> On Sep 18, 1:51 am, SpringFlowers AutumnMoon

> If you like TextMate, you might try ‘e’ on Windows.  
> [http://www.e-texteditor.com/](http://www.e-texteditor.com/)
> 
> IMO, it’s not nearly as good (but then few things are); but it’s the  
> closest I’ve found.

wow, it really is good.  
the only thing is when i tried to change the Font using “Settings”, it  
is not shown. Searching on their forum shows that you need to do it  
through “Edit Theme”.

the other thing is that it doesn’t have a “Save Project” or “Close  
project” option… even though it has a “Recent Projects” option. Maybe  
it is just treating a folder as a project.

---

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [September 22, 2007, 4:11pm UTC](https://www.ruby-forum.com/t/jedit-can-run-code-like-textmate-does/114858/9 "2007-09-22T16:11:22Z")

</div>

On Sep 18, 1:51 am, SpringFlowers AutumnMoon  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am using jEdit on windows for Ruby, and it seems to lack a function to  
> run code by popping up a new window. (by pressing F5 like in IDLE for  
> Python, or %-R for mac using TextMate). The result window on TextMate  
> looks really good by the way.

If you like TextMate, you might try ‘e’ on Windows.

> **[人気の自動車保険を口コミ・相場からランキングでご紹介!](https://www.e-texteditor.com/)**
>
> 人気のある自動車保険を口コミやランキングで検証!

IMO, it’s not nearly as good (but then few things are); but it’s the  
closest I’ve found.
