Request for a new command line switch --singleInst
There is currently a command line switch to load a second instance of Notepad++ (
But if we have “always in multi-Instance mode” turned on in
Multi-Instance, then there is no way to open a document from the command line or a shortcut without starting a new session.
I would like to propose a new
-singleInstcommand line switch in order to open a file into the existing instance when Multi-Instance is enabled.
I realize that this presents a potential difficulty of choosing which instance to open a file into when multiple instances are open, but perhaps there is an internal identification system for each instance that can be specified? For example, to load a file into the second instance, you could use:
-singleInst [instance ID|PID]
Mine wold be to remove that preference setting, thus no multi Instance set. Then have 2 shortcuts, one with the multiInst and one without. Run which ever is appropriate.
Given it is so easy to set it up in this manner I doubt the developers would consider coding changes to suit this request, if you were to place it on GitHub for consideration.
My 2 cents worth
I believe that this is similar to what @Hans-v-Buitenen asked for in https://community.notepad-plus-plus.org/topic/19875/add-commandline-parameter-for-no-multiinstance .
I can see some benefit to being able to say “add this to specific instance X of notepad++.exe”, but as you say, there may be implementation difficulties.
As I recommended in the other post, while this forum is great for getting initial reaction to a new idea, in the end, this isn’t the official feature request site.
As far as implementation goes, you chose “PID” as a possible identifier; that and hWnd stick out at me as good choices – but for either one, Notepad++ would have to make it dead-easy (like adding it to the Debug Info) for any user to know what that ID was for a given Notepad++ window. But, at the point that you’ve clicked back into the specific instance of Notepad++ to find out its ID, you’ve entered the situation where “isn’t it easier for you to just copy the path of the folder you’re in from cmd.exe, then click into the chosen instance of Notepad++ and File>Open, paste in your path, and choose the file?” – if you’re going to click in Notepad++ anyway, why not use Notepad++ do open the file in the instance of your choice.
I do understand that there might be a circumstance like using a batch file to automate distributing certain groups of files among various instances of Notepad++, like in the other thread I referenced. But then there’s the workaround I suggested there (craft a session XML file, and load that session, so you get all the files at once)
Unfortunately for those of you who are asking for it, often times suggestions that have workarounds that don’t require a new feature often get told “just use the workaround”. But maybe your post and Hans’s post will work toward drumming up enough support that Notepad++ developers will decide it is worth it.
It was a wishlist item and my wishlist doesn’t trump pressing needs. Too often the perfect is the enemy of the good.
I don’t know what’s involved in ongoing Notepad++ development, and whether it would have been a, “hey, good idea, I’ll whip that together in 10 minutes and be done with it” or if it would be, “hmm, we’ll put together a committee to do a needs analysis prior to committing it to the product roadmap and tasking several developers to develop the unit tests and blah blah blah.”
Either way, my life is 90% workarounds, so I’m fine with it.