Notepad++ is, unarguably, one of the most popular text editing tools of the moment! It supports syntax highlighting of all imaginable programming languages. Best of all, it is open-source software which can be used for free :)
Notepad++ itself is intended to be a text editor. However, we can configure it so it can run some external tools such as loading a web browser with the current file, or compile a Java/C++ source files. This can be done with the help of Notepad++'s built-in
environment variables.
For example, the typical command for running a Ruby program is
ruby "C:\path\to\my\file\myfile1.rb"
To run this command from Notepad++ and applies path of current file instead of "C:\path\to\my\file\myfile1.rb", you can goto
Run menu -> Run ... and type the following command in the only text box in the dialog.
ruby "$(FULL_CURRENT_PATH)"
Now you can try to run this by click on the
"Run!" button of the dialog. The $(FULL_CURRENT_PATH) is one of the environment variables available. The others are
The 5 environment variables contain:
| FULL_CURRENT_PATH | : E:\my Web\main\welcome.html |
| CURRENT_DIRECTORY | : E:\my Web\main\ |
| FILE_NAME | : welcome.html |
| NAME_PART | : welcome |
| EXT_PART | : html |
However, there is a problem left. After you click the "Run!" button, a black command-line window appeared and disappeared immediately so you can't see the result.
You can prevent the command-line window from automatically closing by using this command.
cmd /K ruby "$(FULL_CURRENT_PATH)"
Hope this helps :)
Related pages: