The command palette of Visual Studio Code is enriched by an additional command for opening the active file with Notepad++.
Multiple configuration options are available (see below).
Keyboard Shortcut
A keyboard shortcut Ctrl+K Ctrl+N is set for triggering this command.
Context Menus
The context menus of the VS-Code editor and explorer are extended correspondingly by an additional entry.
This can be configured via the extension settings (see below).
Whats's New (June 2024)
Support for displaying virtual documents as described below by the corresponding configuration options
The following settings are provided and can conveniently be accessed via command Open Settings for 'Open in Notepad++':
Integration into VS-Code
openInNpp.extendExplorerContextMenu: Add Open in Notepad++ to the context menu of the VS-Code explorer (default: true)
openInNpp.extendEditorContextMenu: Add Open in Notepad++ to the context menu of the VS-Code editor (default: true)
openInNpp.decoupledExecution: Run Notepad++ independently of VS-Code, in particular, do not close Notepad++ upon exit of VS-Code (default: true); corresponds to option detached of child process creation
Cursor Position
openInNpp.preserveCursorPosition: Let Notepad++ preserve the cursor position of the VS-Code editor (default: true); corresponds to command line parameters -n / -c; if set to falseNotepad++ will position the cursor at the beginning of the first line
Notepad++ Execution
openInNpp.Executable: Specifies the path of the Notepad++ executable; if not explicitly set a lookup in the following order is made
%ProgramFiles%\Notepad++\notepad++.exe
%ProgramFiles(x86)%\Notepad++\notepad++.exe
C:\Program Files\Notepad++\notepad++.exe
C:\Program Files (x86)\Notepad++\notepad++.exe
notepad++.exe (fallback lookup via the folders of the Windows %PATH% environment variable)
openInNpp.workingDirectory: Specifies the path of the folder used as working directory during the execution of Notepad++; if not explicitly set the folder containing the file to be opened is enforced as working directory or - when a folder is opened - the folder itself is also used as working directory; if a relative path is specified here it will be based on the first workspace folder of VS-Code
Instances & Sessions
openInNpp.multiInst: Open a separate instance of Notepad++ for each command execution (default: false); corresponds to command line parameter -multiInst
openInNpp.skipSessionHandling: Prevent Notepad++ from loading the previous session and changing its state (default: false); corresponds to command line parameter -nosession
Folder handling
openInNpp.openFolderAsWorkspace: When passing a folder path along to Notepad++ let this folder be handled as a workspace (default: false); corresponds to command line parameter -openFoldersAsWorkspace
openInNpp.filesInFolderPattern: Instead of passing a folder path along to Notepad++ find all files (relative to this folder) matching the specified glob pattern and let the result list become the arguments of the execution of Notepad++; Notepad++'s default handling of a folder path likely corresponds to applying the pattern **/*.* (i.e. subfolders are recursively taken into account, due to this the pattern *.* is possibly a good choice)
Virtual Documents
openInNpp.virtualDocumentsDirectory: When a file does not exist in the local filesystem as it is actually a virtual document a shadow copy of this document will automatically be created in the specified folder and then shown in Notepad++. If no folder is specified here an info message will present the options to either accept a file path comprising the Windows standard temporary folder %TEMP% or to perform a File-Save-As selection.
openInNpp.virtualDocumentsFileReuse": When file reuse is enabled all VS-Code editor instances referring to the same virtual document will share a common file shadow for being opened in Notepad++. Note that VS-Code editor instances may show different versions of the same virtual document and hence their contents may not be identical. As a consequence the contents of the shadow file will be overwritten to always reflect the particular version to be opened in Notepad++.
Expert Settings
openInNpp.commandLineArguments: Specifies additional arguments to be passed along to Notepad++; a comprehensive overview of the command line parameters of Notepad++ is available here
openInNpp.spawnOptions: Specifies additional options for child process creation; details are available here
openInNpp.developerTrace: Specifies whether extended information is logged to the Developer Tools console
How to
Using a shortcut/link as value for option openInNpp.Executable: the value { shell: true } for option openInNpp.spawnOptions is required when specifying a Windows shortcut pointing to the Notepad++ executable