Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Notepad++ run a Ruby (or other) script directly on text in active tab?

Tags:

notepad++

I know that I can run a Ruby script in my active tab with the command

cmd /K ruby “$(FULL_CURRENT_PATH)”

However, I'd like to do with Notepad++ on my Windows system what I do regularly in BBEdit on my Mac: Have a text file open and then call a Ruby script from a menu, and have that script act on text in my active window without having to actually input the name of the file. Is that possible?

like image 586
Sharon Avatar asked Jun 25 '12 16:06

Sharon


People also ask

How do I run a shortcut in Notepad ++?

1 Answer. Show activity on this post. The shortcut for "Launch in IE" is Ctrl + Alt + Shift + I .

How do I run a Ruby script from the shell?

In this case, it's a Ruby file to be executed with the Ruby interpreter. To mark the file as executable, run the command chmod +x test. rb. This will set a file permission bit indicating that the file is a program and that it can be run.

How do I create a Ruby script?

Creating a Ruby Script. Let's start by creating a "Hello World!" script in Ruby. #!/usr/bin/env ruby puts "Hello world!" We can run this script in the command line by going to the directory where the file lives and typing in ruby hello.


1 Answers

To run a Ruby script in Notepad++, first install the NppExec plugin if it’s not already installed. Then in Notepad++ either hit F6 or go to Plugins > NppExec > Execute. In the Execute Command dialog type in the following:

ruby "$(FULL_CURRENT_PATH)"

See this for additional commandline options

like image 103
Gunnar Avatar answered Dec 02 '22 07:12

Gunnar