1

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 http://content.screencast.com/users/JocelynLegault/folders/Jing/media/7cec643e-0924-479d-b31a-a40c691ec25d/2009-11-18_1814.png

What I expect:

alt text http://content.screencast.com/users/JocelynLegault/folders/Jing/media/211d1b9f-6f66-458e-9a19-61b7e9b19b43/2009-11-18_1816.png

3
  • By the way, I didn't even know about this functionality, so thanks for pointing it out!
    – JRL
    Nov 19, 2009 at 0:38
  • First off, you need to have the NppExec plugin install. Then, you do Menu > Plugins > NppExec > Execute... and in the <temporary script>, type in the exe (or batch, or any executable you can think of). The console will appear with the results in there.
    – joce
    Nov 19, 2009 at 0:41
  • Actually, there's a shorter way via the Console button on the menu bar.
    – JRL
    Nov 19, 2009 at 0:46

2 Answers 2

1

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"
1
  • 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
    Oct 24, 2010 at 16:02
0

For IRB, just run irb.bat.

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

alt text http://img198.imageshack.us/img198/8373/86448854.jpg

6
  • 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
    Nov 19, 2009 at 0:39
  • @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
    Nov 19, 2009 at 0:40
  • Yes it is. Maybe I'm not jsut using the right version of NppExec. What version are you using?
    – joce
    Nov 19, 2009 at 0:46
  • NppExec 0.3 RC1. Do you have irb.bat in your system path?
    – JRL
    Nov 19, 2009 at 0:48
  • I'm using 0.3.2, and it does not work. See screencast.com/t/ZTFhZTUy to get what I'm talking about.
    – joce
    Nov 19, 2009 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.