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.
- Download the Session Manager plugin archive file.
- Exit Notepad++.
- Extract the archive file (with subfolders) into the Notepad++ plugins folder.
- Start Notepad++.
- 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").
- 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.
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.
- 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.
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.
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.
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"/>
<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.
- 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.
- 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.
- Added danrathbun's Context Menu tip to the Help file. There were no code changes.
- 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.
- 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.
- 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.
- 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.
- 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.
- Initial release. Compiled with VC++ 2010. Tested with Notepad++ v5.9.2 on WinXP-SP3. Unicode only.