Option to skip "Create new file" prompt(s) when pressing Alt+F6 while text is selected
-
If pressing Alt+F6, to create a new NP++ instance, while some text is selected (easy to forget to deselect text), there seems to be no way to skip at once all the “Create new file” prompts (showing back to back for each word selected, which could be thousands). Looks like clicking No to every single prompt or killing the app are the only solutions.
I think the “Create new file” prompts should have an additional option like ‘Create a blank instance’ as a solution to create a new instance like it would if no text was selected.
-
The name of the command is literally “open selected file path in new instance”. If you don’t want it to use the selection as the name of the path to open, don’t use that command. Every command in that Run menu, except for the first Run… and last Modify Shortcut/Delete Command is a user-customizable command. You can remove those entries from the menu using the Delete Command portion of the latter; and you can add new entrie using the Save… button in the Run… dialog.
The Open selected file path in new instance entry is literally just running the command
$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst
, which is essentiallynotepad++.exe <current selection> -nosession -multiInst
. If your current selection is blank (and the caret isn’t in a word), then it will be equivalent tonotepad++ -nosession -multiInst
If all you want is a command that launches a new instance of Notepad++, you could just Save… another command of
"$(NPP_FULL_FILE_PATH)" -nosession -multiInst
, and set it to whatever keyboard shortuct you want to mean “open a blank new instance”If you only ever want it to either open the single selected file or open a blank new instance, then you could edit
%AppData%\Notepad++\shortcuts.xml
and change the command line for “Open selected file path in new instance” to"$(NPP_FULL_FILE_PATH)" "$(CURRENT_WORD)" -nosession -multiInst
– the quotes around the$(CURRENT_WORD)
make it treat the entire selection as a single filename. If the selection/caret is blank, then it will just open the new instance, as before; if the selection is an existing file, that file will be opened; if the selection is a word or multiple words that don’t resolve to a filename, it will prompt once to create the file, but never more than that. (However, because it’s using Windows CreateProcess or similar technology, if you send it a command with characters that will mess up a cmd.exe command-line command, it will give an error message.) -
@PeterJones
Thank you, that was useful :) I’ve updated shortcuts.xml so Alt+F6 now ignores selected text.<Command name="Open new instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_FULL_FILE_PATH) -nosession -multiInst</Command> <Command name="Open selected file path in new instance" Ctrl="no" Alt="no" Shift="no" Key="">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command>
I hadn’t taken a moment before posting to find what Alt+F6 was labelled as. I’ve been using this command via the keyboard shortcut for a long time and not via the Run menu.
For basic users, I think it could be useful to have this as an out of the box option e.g. File > New Window (Ctrl+Shift+N).
Thanks again!