Session Manager 0.8.2

A Plugin for Notepad++

Downloads  |  Notepad++ Home  |  Notepad++ Forums  |  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. These properties are stored in an XML file referred to as a session file. Some of these properties can be synchronized across different session files. See Global Properties for details.
  • 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 the settings.ini section). 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 (alt+l): 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 (alt+p): Loads the previous session.

Default: Loads the default session.

Save (alt+s): 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.
  • As a copy of the current session: Create a new session by copying the current session.
  • As a copy of 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 following options affect how a session is loaded. They provide for the combining of sessions.

  • Load into current (alt+i): 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 (alt+w): 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.

The following options determine how the sessions list is sorted.

  • Sort by alpha (alt+a): Sorts alphabetically.
  • Sort by date (alt+d): Sorts by most recently used. Sessions with the same last-modified time are sorted alphabetically.

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;
    • when a file's bookmark margin is clicked;
    • 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 current checkbox will be checked when the Sessions dialog is displayed. The default value is 0 (disabled).
  • Load without closing: If this is enabled the Load without closing checkbox will be checked when the Sessions dialog is displayed. The default value is 0 (disabled).
  • 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 (disabled).
  • 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 (disabled).
  • Global bookmarks: This enables or disables the global bookmarks feature (see the Global Properties section). Note that if Auto save is disabled your global bookmarks will only get updated when you manually save the current session. The default value for Global bookmarks is 1 (enabled).
  • 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.

Global Properties

Notepad++ saves a file's bookmarks (and other properties) in the session file, so the same file in different sessions will not have the same bookmarks. Session Manager can keep files' bookmarks (and a little more) synchronized across different sessions (See Global bookmarks in the Settings Dialog section).

The file "file-properties.xml", in the Session Manager configuration directory, stores bookmarks, firstVisibleLine, language and encoding for each unique pathname in all your sessions. There are 3 cases where these global properties are used...

  • After a session is saved, the global bookmarks, firstVisibleLine, language and encoding are updated from the session properties.
  • When a session is about to be loaded, the session bookmarks, language and encoding are updated from the global properties, then the session is loaded.
  • When an existing document is added to a session, its bookmarks and firstVisibleLine are updated from the global properties, then the session is saved.

File nodes are never removed from the global properties file so if you remove a certain file from all sessions then later add it to a session it will have bookmarks and firstVisibleLine restored from the last time it was part of a session.

This feature was introduced in Session Manager 0.8, so if you have been using version <= 0.7.1 and you install version >= 0.8, the global properties file will be initially empty. Your global bookmarks will get updated as you load different sessions. You can speed up this process by loading all your sessions, one by one, in order from earliest to latest last-modified time, or in order from least to most important.


The following properties are not accessible via the Settings dialog but must be edited directly in the "settings.ini" file. Close Notepad++ and use some other editor to edit this file.

  • saveDelay: You probably will not need to change this property. See the Shutdown section for details. 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 the Plugin Menu section) 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 probably not useful unless you are debugging SessionMgr itself. The default value is 0. If you are curious, set it to 30 and specify a logFile.
  • logFile: This property is in the [debug] section and is used only if debug > 0. The value must be an absolute pathname of a file to which debug messages will be printed.


Session Manager does not immediately save the current session when a file is closed. It must determine if a shutdown is in progress in which case all files will be closed. We don't want to save the session if files are being closed due to a shutdown. When Notepad++ is about to shutdown it closes all files before it sends the shutdown notification to plugins. To work around this, when a file is closed Session Manager waits for saveDelay seconds (see the settings.ini section). If the shutdown notification has not been received at the end of that time then the current session is saved.

This is not an ideal solution but it is very rare for a session to be saved incorrectly. When you initiate a shutdown Notepad++ first checks all open files. If a file is modified Notepad++ will offer to let you save the file, not save the file, or cancel the shutdown. If you choose to save the file then the plugin will receive NPPN_FILEBEFORESAVE, SCN_SAVEPOINTREACHED and then NPPN_FILESAVED, as usual. Notepad++ then continues checking open files and prompting you if any are modified. Only after all files have been checked does Notepad++ begin closing files.

So far, there is only one scenario I have found where Session Manager will save the session incorrectly. If you close one or more files and then quit Notepad++ before saveDelay seconds have elapsed then those closed files will still be part of that session.

Ideally, Notepad++ would issue NPPN_BEFORESHUTDOWN, then close all files, then issue NPPN_SHUTDOWN. In the case where the user cancels the shutdown it would issue NPPN_CANCELSHUTDOWN.


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: Name your sessions with categorized prefixes or suffixes. This will group related sessions together in the list when it is sorted alphabetically. 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.
  • Usage Scenarios: Here are two basic usage scenarios.
    • Enable the Auto load setting so 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.

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.8.2, 19Oct2014

  • Fixed a bug reported by Pavel (thanks!): When about to load a new session, do not save the current session if Auto save is disabled.
  • In the "Create New Session" dialog, renamed "From the currently open files" to "As a copy of the current session" and renamed "By copying the selected session" to "As a copy of the selected session".
  • Renamed some Config class methods.
  • Tweaked some button positions.
  • Made improvements to the help page.

0.8.1, 12Oct2014

  • Added an option to sort the sessions list by the session files' last-modified times in addition to alphabetically.
  • Improved the algorithm for resizing/repositioning controls when the dialog is resized by the user. Fixed a bug related to saving/restoring the dialog size.
  • Added a checkbox on the Settings dialog for the global bookmarks feature.
  • Some controls on the Sessions dialog now have keyboard shortcuts. Hold Alt then hit: l = Load, p = Previous, s = Save, i = Load into current, w = Load without closing, a = Sort by alpha, d = Sort by date.
  • Improved debug logging. Current and active buffer IDs are logged for notifications.
  • Changed the About text. Big updates to the help page.

0.8, 05Oct2014

  • Global bookmarks! Uses TinyXml2.
  • Saves the session when the bookmark margin is clicked.
  • Writes messages to a log file when in debug mode.
  • Uses Windows SDK v7.1, was v7.0a. Still uses MSVS2010 command-line tool chain.
  • Updated header files from NPP 6.6.9.

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

  • 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.