Open lifenjoiner opened 5 months ago
There is no use of N2Root
and modify PATH
isn't good. When integrating 3rd tools, we can find their executable from
GetProgramRealPath()
, same directory as Notepad2.exe.GetModuleFileName()
, same directory as symbolic link to Notepad2.exe.SearchPath()
The key logic is launching other files in the order of: dir of the opened file (current dir)
--> dir of notepad2
--> systerm path
.
I tried getting the dir of notepad2
dynamically, and then implement the logic. But, I did not manage it as simple as this, if dir of notepad2
is not added at the head of PATH
.
Modified environment variables only have the lifetime in the current progress and its descendants. It won't be a problem.
Without N2Root
, what if there is rg.bat
/rg.exe
/rg.js
in dir of the opened file, and also in the dir of notepad2? Isn't %N2Root%\rg
simpler?
Reasons to modify Path
:
current dir
--> Path
. And we should insert dir of notepad2
between them.Ctrl + R
--> cmd
--> rg
" won't be possible, if don't modify Path
.delayed this until there is real usage for the changes.
Kind of solution for https://github.com/zufuliu/notepad2/issues/259.
For
grepWin
using a launcher:D:\grepWin\grepWin_portable.exe
for example.gw.bat
:notepad2 /g %line% %path%
.Ctrl + R
-->gw
, search or replace.For
ripgrep
:rg.exe
in the same directory asnotepad2
.Ctrl + R
-->cmd
-->rg
.N2Root
is in case of there is the same name files in the directory of the opened file and notepad2, it can be used as a short and unique prefix.