Page 1 of 1

[Notepad++] Launch Project From Any File

Posted: Tue Jan 15, 2019 5:20 am
by Helvecta
Howdy :crazy:

For Notepad++ users, here's a quick post about how to launch your LOVE2D project from any open file under that project's directory. In short, no more of this:
Familiar error screen wrote:boot.lua:479: No code to run
Your game might be packaged incorrectly.
Make sure main.lua is at the top level of the zip.
1.) Install Notepad++
2.) Install NppExec through Plugins > Plugins Admin...
3.) Press F6 to execute a command, and paste the following:

Code: Select all

NPP_CONSOLE 0
powershell.exe -command "$path = '$(FULL_CURRENT_PATH)'; $file = 'main.lua'; while($path -and !(Test-Path (Join-Path $path $file))){ if($path -eq ((Split-Path -Path $path -Qualifier)+'\')){ break } else { $path = Split-Path $path -Parent } } & 'C:\Program Files\LOVE\love.exe' $path;"
4.) Click "Save..." and enter a name. Click "Save" to execute and save that script for future use.
5.) From NppExec's advanced options (Plugins > NppExec > Advanced Options...), choose your saved script from the "Associated script:" dropdown, then click "Add/Modify".
6.) Still within NppExec's advanced options, select your newly made entry from the "Menu Items *" section, then check the "Place to the Macros submenu" checkbox.
7.) Restart Notepad++.
8.) From within the shortcut mapping tool (Settings > Shortcut Mapper...), go to the "Plugin commands" tab, then find your entry at the bottom. Assign a shortcut to this entry.

You will now be able to use your new shortcut to launch the project, as long as main.lua is in the current directory or a parent directory. For me, this has proven a more effective method than the wiki's currently recommended solution.

Re: [Notepad++] Launch Project From Any File

Posted: Sun Oct 06, 2019 1:59 pm
by YounYokel
Very good. One thing you can add in "Execute" option is this at the begging:

Code: Select all

NPP_SAVE
It will save the project.

Re: [Notepad++] Launch Project From Any File

Posted: Sun Oct 06, 2019 6:24 pm
by ivan
This is a great idea!
Here is my version using just Lua/Love2d (without NppExec):

1.) Download "ezload.love" and save it somewhere
2.) Install Notepad++
3.) Press F5 and enter the command:

Code: Select all

C:\path\to\love.exe C:\path\to\ezload.love -console -fused "$(FULL_CURRENT_PATH)"
Note that "-console" and "-fused" are optional (and make sure to use one dash "-" instead of two "--")
4.) Click "Save..." and enter a name. Click "Save" to execute and save that script for future use.

That's it!
Notepad++ will automatically find and run your project based on the current file you are editing.

Re: [Notepad++] Launch Project From Any File

Posted: Mon Nov 30, 2020 3:00 pm
by YounYokel
You could also bind a key to current file's folder with CMD, and then run love . or lovec . commands if you added the LOVE location in your environment variables list.