views:

277

answers:

2

Hello,

I'm a Notepad++ user. One of the features I like from that software is the fact that you can have a "console" in the UI (which is not an actual terminal), and that you can run some command line interpreters from there.

FYI, to get the console running in Notepad++, you need to have the NppExec plugin installed, and then go to Menu > Plugins > NppExec > Execute... and type in whatever executable file you want in there (exe, batch, etc) and press OK. The Console will be brought up, and you'll see the output of your program in there, and in the case of an interactive shell, you can also input commands.

For example

  • for an actual DOS prompt, you run cmd.exe
  • for a Python prompt, you run python.exe -i.
    • From the Python help: -i inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x

Now, I'm wondering if there's a way to get a similar prompt with irb. Anybody has an idea how to get that running in Notepad++?

Update

There's mention in the answer(s) I got that it already works in Notepad++ 5.4.5. In my view, it does not.

What I get from Notepad++:

alt text

What I expect:

alt text

A: 

For IRB, just run irb.bat.

This is what it looks like (Notepad++ 5.4.5 and NppExec 0.3 RC1):

alt text

JRL
Does not work from the Notepad++ console. You don't get an interactive shell in there by doing that (no more than you get an interactive python shell in there by doing `python`). That's the whole point of my question.
Joce
@Joce: I just tried it, and it did give me the irb shell prompt. I tried 3+4 and it returned 7. I'm using v5.4.5. Is that not what you were asking for?
JRL
Yes it is. Maybe I'm not jsut using the right version of NppExec. What version are you using?
Joce
NppExec 0.3 RC1. Do you have irb.bat in your system path?
JRL
I'm using 0.3.2, and it does not work. See http://screencast.com/t/ZTFhZTUy to get what I'm talking about.
Joce
Ha! I see that you can type in stuff and have the results and stuff. But it's not the actual irb prompt that you get.
Joce
A: 

use the following script in npp_exec:

cmd /c start what_you_want_to_execute

explanation: to get a new instance of cmd, you need to use the start command. But the start command only works in cmd. So you execute cmd first with option /c so it'll execute the stuff that follows and exit after that. Then you use the start command with what you need to execute.

To make it a little prettier you can use:

cmd /c start cmd /q /c "what_you_want_to_execute && pause"

same as before, only now you use the start command to start cmd with option /q, which stands for quiet and does the same as @echo off in a .bat file. Again the /c option. Then the thing you want to execute plus pausing afterwards. Those last two thing are between quotes so the first call to cmd doesn't execute it in the npp_exec console.

I use this script to execute java sometimes:

cmd /c start cmd /q /c "C:\Progra~1\Java\jdk1.6.0_17\bin\java.exe -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)" && pause"
Apanatshka
Hum. That starts a cmd prompt window. It's not a way to get the irb prompt to show up properly in the N++ console window. Sadly.
Joce