Session Manager 0.7.1

A Plugin for Notepad++

Downloads  |  Notepad++  |  Plugin Central


Use the Notepad++ Plugin Manager for easy installation or upgrade of Session Manager. New releases of Session Manager may be available here before they are available in the Plugin Manager. In that case use the following manual installation/upgrade procedure.

  1. Download the Session Manager plugin archive file.
  2. Exit Notepad++.
  3. Extract the archive file (with subfolders) into the Notepad++ plugins folder.
  4. Start Notepad++.
  5. Open the Settings dialog (alt+p,s,t) and configure Session Manager as you wish.

That completes the manual installation/upgrade procedure, but please note...

Session Manager will create its configuration files, if they do not already exist, in the plugin configuration folder reported by Notepad++. For more information see the Installation Folder and Configuration Files Notepad++ wiki pages (search for "doLocalConf.xml" and "allowAppDataPlugins.xml").

Basic Concepts

  • Session: A Notepad++ session consists of the pathnames of all the currently open files, their containing view, their tab order, their language setting, their cursor position, and more. This information is stored in an XML file and is referred to as a session file.
  • Selected: The selected session is the highlighted session in the list of session names on the Sessions dialog.
  • Current: The current session is the active session – the one most recently loaded.
  • Previous: The previous session is the prior current session.
  • Default: When there is no current session a default session is used. It is located in the Session Manager configuration folder.
  • Loading: In general when loading a session, the current session will be saved then all its files closed. The selected sessions' files will be opened and it then becomes the current session. See below for options that affect how a session is loaded.
  • Saving: Saving a session means saving information about the currently open files in a session file. Saving a session does not save the session's open files.

Plugin Menu

You can customize Session Manager's plugin menu items (see settings.ini). The default labels and shortcuts follow. Configure your own shortcuts with the Notepad++ Shortcut Mapper.

Main (Plugin) Menu Item

  • Session Manager (alt+p,s): Opens the Session Manager submenu.

Submenu Items

  • Sessions (alt+p,s,s): Opens the Sessions dialog.
  • Settings (alt+p,s,t): Opens the Settings dialog.
  • Save current (alt+p,s,v): Saves the current (or default) session.
  • Load previous (alt+p,s,p): Loads the previous session.
  • Help (alt+p,s,h): Opens this HTML help file in your default web browser.
  • About (alt+p,s,a): Displays Session Manager version and other information.

Sessions Dialog

Load: To load a session double-click a session name in the list, or select it then click the Load button. It then becomes the current session.

Previous: Loads the previous session.

Default: Loads the default session.

The following options affect how a session is loaded. They provide for the combining of sessions.

  • Load into the current session: If this option is checked the selected session will be loaded but it will not become the current session, although the currently open files will be closed unless you check the next option.
  • Load without closing open files: If this option is checked the currently open files will not be closed before the selected session is loaded. For convenience this option is checked automatically when the above option is checked.

Save: Saves the current (or default) session.

New: Creating a new session does not load the new session – it creates it, adds it to the list and selects it. You can then load it if you wish. There are three options for creating a new session.

  • As an empty session: Create a new, empty session. Note that an empty session contains no files, however Notepad++ always has at least one editor tab open. In this case it is a new buffer which has not yet been saved to a file. After opening other files you can simply close the new buffer if you do not need it.
  • From the currently open files: Create a new session containing the currently open files.
  • By copying the selected session: Create a new session by copying the selected session.

Rename: Renames the selected session.

Delete: Deletes the selected session. This does not delete the session's files – only the session file itself, and it will be removed from the list. You will be asked for confirmation before the deletion.

Close: Press the ESCape key, or click the Close button, to close the Sessions dialog.

The Sessions dialog is resizable and remembers its size. Drag one of the corners or sides of the dialog to resize it.

Settings Dialog

  • Auto save: If this is enabled the current session is saved...
    • when any file is saved;
    • when a file's Language changes;
    • before a new session is loaded;
    • when any file is opened, except when files are being opened due to a session being loaded;
    • when any file is closed, except when files are being closed due to a session being loaded or due to a Notepad++ shutdown.

    If Auto save is disabled sessions will only be saved when you select Save current from the plugin menu or click the Save button on the Sessions dialog. The default value for Auto save is 1 (enabled).

  • Auto load: If this is enabled the most recently opened session will be loaded when Notepad++ starts up. If you enable Auto load you should disable the Notepad++ Remember current session for next launch feature. The default value for Auto load is 0 (disabled).
  • Load into current: If this is enabled the Load into the current session checkbox will be checked when the Sessions dialog is displayed. The default value is 0.
  • Load without closing: If this is enabled the Load without closing open files checkbox will be checked when the Sessions dialog is displayed. The default value is 0.
  • Show in title bar: If this is enabled the current session name will be prepended to the text in the Notepad++ title bar. The default value is 0.
  • Show in status bar: If this is enabled the current and previous session names will be displayed in the Notepad++ status bar. The default value is 0.
  • Session files folder: This specifies the location of the session files Session Manager will display in the Sessions dialog. Click the ... button to browse for a folder. Set to an empty string to get the default value: plugins\config\SessionMgr\sessions.
  • Session file extension: This specifies the file name extension of the session files Session Manager will display in the Sessions dialog. Think of it as a filter. Set to an empty string to get the default value: .npp-session.

Click the OK button to save and activate your changes. Press the ESCape key, or click the Cancel button, to cancel your changes and close the Settings dialog.

The Settings dialog is resizable and remembers its size. Drag one of the corners or sides of the dialog to resize it.


The following properties are not accessible via the Settings dialog but must be edited directly in the "settings.ini" file.

  • saveDelay: You probably will not need to change this property, but if you do... Session Manager does not immediately save the current session when a file is closed. It must determine whether a shutdown is in progress, in which case all files will be closed but we don't want to save the session then. When Notepad++ is about to shutdown it sends file-closed notifications before it sends the shutdown notification. To work around this, when a file is closed Session Manager waits for saveDelay seconds. If the shutdown notification has not been received at the end of that time then the current session is saved. The default value is 3.
  • sessionsW, sessionsH, settingsW and settingsH: These properties are in the [dialog] section. They store the sizes of the Sessions and Settings dialogs. You can set these to 0 to reset their sizes to the defaults.
  • main, sub1, sub2, etc.: These properties are in the [menu] section. They optionally define the labels for the Session Manager plugin menu. Session Manager will use default values (see Plugin Menu) for any items not defined here. Here is an example of customizing the menu items:
    main=Session &Manager
    sub3=&Save current
    sub4=&Load previous
  • debug: This property is in the [debug] section. This is not useful unless you are debugging SessionMgr itself. The default value is 0.


Here are some tips for using Session Manager more efficiently.

  • Shortcuts: Get in the habit of using the keyboard shortcuts, instead of the mouse, to open Session Manager dialogs.
  • Favorites: Make a session containing the favorite file(s). Any time you need those files just click "Load into the current session" then load that session.
  • Categories: The Sessions list is sorted alphabetically so name your sessions with categorized prefixes or suffixes. This will group related sessions together in the list. For example, I prefix my "favorites" sessions with an underscore because I want those to appear at the top of the list. I have many web-related projects and I prefix those session names with "www_". An example of using a suffix is: "my-project_trunk", "my-project_rev-123", etc. That keeps them grouped together in the list.
  • Large Projects: Sometimes I'll have a large project and end up creating many different sessions for it. Usually it's the type of project that may last for a relatively long time, but after the project is finished I don't want all those sessions cluttering the Sessions list – but I also may not want to delete all of them. Here's how Session Manager can help in this situation: use different session folders, and/or file name extensions. Using a different session file name extension works quite well. It keeps all session files in one folder and then the extension acts as a filter for what sessions are displayed in the Sessions list. Also, a different default session is created for each different extension. Changing the extension back to the default is easy – just leave the extension field blank, in the Settings dialog, and the default will be used.
  • Usage Scenarios: Here are two basic usage scenarios.
    • Enable the Auto load setting so that some session is always current. Loaded sessions become current and change to always reflect the latest changes to that session. This scenario does not use the default session.
    • Disable the Auto load setting, enable the Load into current setting and disable the Load without closing setting. In this scenario the default session is always current. When other sessions are loaded they are loaded into the default session. Other sessions do not change but always contain the same files, and the default session always represents the most recent editing session.
  • Context Menu: This great tip was contributed by danrathbun. He shows us how to add a Session Manager submenu to the context (right-click) menu.
    • From the Notepad++ main menu select Settings then Edit Popup ContextMenu.
    • Insert the following. Where you insert it will determine the submenu's position in the Context Menu. The values of the PluginEntryName attributes must match the Session Manager main (plugin) menu item name. The values of the PluginCommandItemName attributes must match the Session Manager submenu item names. You can customize the values of the FolderName and ItemNameAs attributes.
      <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Sessions..." ItemNameAs="&Open..."/>
      <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Settings..." ItemNameAs="&Configure..."/>
      <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Save current" ItemNameAs="&Save current"/>
      <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Load previous" ItemNameAs="&Load previous"/>
      <Item FolderName="Session &Manager" id="0"/>
      <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="Help" ItemNameAs="&Help"/>
      <Item FolderName="Session &Manager" PluginEntryName="Session Manager" PluginCommandItemName="About..." ItemNameAs="&About..."/>
    • Optionally you can make the following change so that right-click,s properly executes "Select All", since "Session Manager" also begins with an "S". Change this line:
      <Item MenuEntryName="Edit" MenuItemName="Select All"/>
      To this:
      <Item MenuEntryName="Edit" MenuItemName="Select All" ItemNameAs="&Select All"/>
    • Save your changes to the "contextMenu.xml" file and restart Notepad++. Now try right-click,m,o. There are many possibilites. Configure it to what is most convenient for yourself. Read more about this tip at the forum. This discussion began at post #17.

Your feedback is very welcome!

There is an ongoing discussion at sourceforge, join us!

A very special thank you! to those who are testing and providing excellent feedback at the forum.

Revision History

0.7.1, 20Jan2013

  • Issue reported by light2some: When a file is first changed the titlebar text does not get the session prefix. Fix: Update the titlebar text one second after the SCN_SAVEPOINTLEFT Scintilla event (NPP doesn't prepend the "*" until after the event).
  • Upgraded header files from NPP v6.2.3: menuCmdID.h, Notepad_plus_msgs.h, PluginInterface.h and Scintilla.h.
  • [Minor NPP bug?] It's not a problem but I noticed that, in Notepad_plus_msgs.h, NPPN_DOCORDERCHANGED and NPPN_READONLYCHANGED have the same value (NPPN_FIRST + 16). Also, I cannot detect either of these events in my plugin code, even tho NPPM_INTERNAL_DOCORDERCHANGED seems to be handled correctly in the NPP source code.

0.7, 13Jan2013

  • This is a candidate for version 1.0.
  • The Sessions dialog and the Settings dialog now remember their sizes after being resized.
  • The previous session is now remembered and can be loaded via a new menu option, "Load previous", and a new button on the Sessions dialog, "Previous".
  • The name of the current session is now prepended to the text in the Notepad++ title bar. This is enabled by a new option on the Settings dialog, "Show in title bar".
  • The names of the current and previous sessions are now displayed in the Notepad++ status bar. This is enabled by a new option on the Settings dialog, "Show in status bar".
  • The labels for the Session Manager plugin menu are now optionally defined in the settings.ini file.
  • The setting "Enable 'Load into current'" was renamed to "Load into current". The setting "Disable 'Load without closing'" was simplified to "Load without closing".
  • There is now a folder browse button next to the "Session files folder" edit control on the Settings dialog., 17Jun2012

  • Added danrathbun's Context Menu tip to the Help file. There were no code changes.

0.6, 21Mar2012

  • The bugfix in the previous release has been confirmed.
  • In the New Session dialog box, clicking one of the options (when the edit field is empty) will populate the edit field with the selected session name.

0.4.1, 20Mar2012

  • Possible bugfix (strange characters in names): I think I have found and corrected this problem.
  • Changed button name from Cancel to Close on the Session Manager dialog.
  • If the session directory specified in the Settings dialog does not exist then it is created.

0.4, 29Nov2011

  • Changed Sessions and Settings dialogs to have TOOLWINDOW style.
  • Bugfix: When the Sessions listbox was displayed the focused item and selected item were not always the same.
  • Added getLbIdxByData and dbgBox in Util.cpp.
  • Added enableLIC and disableLWC to DEFAULT_INI_CONTENTS.
  • Commented-out saving of current session on NPPN_DOCORDERCHANGED - this event never occurs?
  • Moved definition of unicode constants from System.h to Makefile.

0.3, 03Oct2011

  • The 0.2 source archive did not include the build files. They are included now.
  • Session template files are no longer used.
  • Previously, upgrading Session Manager would cause the existing configuration files to be over-written. Now that does not happen. Session Manager creates default configuration files only if they do not already exist.
  • Session Manager now uses a default session (located in the config folder) if there is no current session. The default session can be loaded by clicking the newly added Default button on the Sessions dialog.
  • A Save button has been added to the Sessions dialog. It saves the current (or default) session.
  • Sessions are auto-saved on two additional NPP events: NPPN_LANGCHANGED and NPPN_DOCORDERCHANGED.
  • The second option for creating a new session has changed to "From the currently open files", which basically is a session "save as" feature.
  • Previously if you opened files by passing them on the Notepad++ command line and Auto load was enabled then Session Manager would close the file(s) Notepad++ had just opened (passed on the command line). This has been corrected. Now Session Manager will not close open files when auto-loading.
  • Increased the initial width of the Settings dialog. Removed all debug properties except one, named "debug". Added two more boolean properties: enableLIC and disableLWC.
  • Add a trailing slash, if needed, to the user-entered session folder. Add a leading dot, if needed, to the user-entered session file extension.
  • Made general improvements to the code. Fixed a dependency-related bug in the Makefile. Made big improvements to the help file.

0.2, 24Sep2011

  • Compile with /MT so the crt library is linked statically.
  • Display a warning if no file name is supplied for New or Rename dialogs.
  • If the config and sessions folders do not exist then create them. If config and template files are not present then default files are created.
  • An empty session folder will not cause an error.
  • Build with an nmake makefile. Still uses the VC++ v10 toolchain, but now is not dependent on any IDE.
  • Removed saveDelay from Settings dialog, but it is still in the .ini file.
  • Sessions and Settings dialogs are sizable but do not yet save user size/position.
  • The session list is read from disk every time the Sessions dialog is displayed. Removed "Refresh Session List" from the menu.

0.1, 03Aug2011

  • Initial release. Compiled with VC++ 2010. Tested with Notepad++ v5.9.2 on WinXP-SP3. Unicode only.