Running your code from inside Notepad++
budski82 last edited by
Hello All just looking for info on running my Ruby code from inside Notepad++. When I am doing a web page I have Ctrl > F12 set as a shortcut to see HTML and CSS changes in Firefox, Ctrl > F10 for Chrome.
I am learning Ruby and have no trouble edited the code > saving the file. Then, while I have the command prompt open. With the up arrow > then Enter it runs the lasted save addition to the Ruby program.
All the tutorials I am following are running everything thru Atom, without having to leave the environment to run the code changes. They say I should have that option with Notepad++. I have found the Run dialog with F5 but am lost as to what to do next. Or add to the form box, it allows you to browse for a program. Asking for exe or All files
I found my way to the Ruby bin folder which holds two different ruby.exe versions // ruby.exe and rubyw.exe
The ruby.exe tool tip offers this when I hover over it: File Description: Ruby interpreter (CUI)
The rubyw.exe tool tip offers this when I hover over it: File Description: Ruby interpreter (GUI)
They list 7 Windows Command Scripts as well
I am not sure what to add to this and just looking for help as I try to learn. It is to spooky this deep in the system to take guest`s. There is no way of adding a screen shot of what I am looking at
I can and will go through the cd and dir steps to get to the ruby file every time I re-start or create a new file. But is there a simple way to save a change and see the results from inside Notepad++ without going back to the cmd line every time. If anyone could please point me in that direction I would love to figure this out myself. but dont want to lock up my system picking around with a screw driver either. Thanks for your time and ears …Peace…
PeterJones last edited by
I don’t know Ruby’s requirements for running a script.
However, in general, such languages use the “w” version of their executable to run the Windows/GUI version, without opening a console window for directing STDOUT and similar to. So if I use the Notepad++ > Run > Run… menu to run
perl -e "print qq(hello world); <STDIN>", it will open up a new console window, print
hello world, then wait for the user to hit ENTER. If instead I ran
wperl -e "print qq(hello world); <STDIN>"(
wperl.exeis Strawberry Perl’s WindowsOnly/NonConolse executable), nothing would pop up, and you’d never get a chance to hit ENTER to give input to STDIN.
If I want to run the current file in perl from the Notepad++ > Run > Run… dialog, I would use
perl "$(FULL_CURRENT_PATH)… or, if I wanted that script run from the same directory as the script,
cmd /c " cd $(CURRENT_DIRECTORY) && perl "$(FULL_CURRENT_PATH)" "(wrapping it in
cmd /c " ... "because
cdis a cmd.exe command, rather than being an executable that NPP’s Run command can find).
However, usually, when I want to run a file using a particular interpreter, I want to use windows default action for that file – so you can use Notepad++ > Run > Run…
"$(FULL_CURRENT_PATH)"just by itself.
But when I’m doing that, I generally want to be in that directory, and I want the output captured in a window that I still have access to when I’m done… so I use the NppExec plugin, with a script that I call “run myself”, which is:
cd "$(CURRENT_DIRECTORY)" cmd /c "$(FULL_CURRENT_PATH)"
I use Notepad++ > Plugins > NppExec > Advanced Options to tell the RunMyself to show up in the Macro menu, and then add a keyboard shortcut that I can remember.
Sorry I couldn’t give specifics for ruby, but hopefully this will help move you in the right direction.
budski82 last edited by
Thanks for your time and reply. At this point in time it is to confusing and more of a distraction. Getting the syntax down is hard enough, worrying about shortcuts is a month or two down the road. Plus the 30 extra seconds it involves to open the command prompt window. Then filter down through the directory is really not that big a deal.
In every tutorial regardless of the language they get incentives for getting you to install the IDE or editor they are pushing. If it is not Atom it is Codepen or Sublime, Video Studio wants you to get the Pro version. Plus it cost you at least $19.00 or more monthly for that functionality.
I am just getting comfortable working off the cmd line and creating directories on C:\ drive. I should worry about getting the roof on before I start looking at carpeting and recliners for the TV room. Thanks for your help, back to learning …Peace…