Not all programs need to have a fancy IDE. If there’s a quick script that you want to run or try, then using a simplier Notepad++ can easily get the job done. And, it already includes syntax highlighting for Ruby.

Prerequisites:

Let’s get started:

  1. Open Notepad++
  2. Add custom menu option to run the Ruby code:

    1. On the menu bar, click Run->”Run…”
    2. On the popup enter the command: cmd /K ruby "$(FULL_CURRENT_PATH)"
    3. Click “Save…”
    4. Enter a name for the custom run command, like “Run Ruby Program”
    5. Click “OK”
  3. Time to test. Add the following program to a new file:

     def factorial(n)
       if n == 1
         1
       else
         n * factorial(n - 1)
       end
     end
     puts factorial(5)
    
  4. Save the file, then click Run->”Run Ruby Program”. You should see the output of the Ruby program in a command prompt.

Congrats, you can now be more productive with the great Notepad++!

Now a quick word from a tech company who helps support me and this site: