Notepad++ "Projects" info
-
So I’ve never explored setting up a “project” in Notepad++.
I’m talking about the View menu’s Project.I didn’t see anything in the user manual about it, but I could have missed it. Side note: It seems tough to find things in the user manual, but that could just be me; maybe I don’t know how to use its searching/navigation capabilities. Once I’m to the appropriate area (if I can get there), the docs are of course very good.
Experimenting, I see there’s a “workspace” concept that one can add a “project” to, but the the View menu in Notepad++ already has “Project 1”, “Project 2” and “Project 3” predefined, so…? Hmmm…
I notice when I quit Notepad++ it wants me to provide a file for my “workspace”, but it doesn’t provide a default extension or a great location for the file. Are there standards for this? Hmm… I would hope for auto-save, but maybe this occurs after a one-time setup.
So I guess my main objective for a “project” is to be able to easily search its files (and only its files). Is there a way to specify this?
I guess the bottom line, is that I’m “N++ project know-how” deficient, and I’d like to improve. So any replies sharing knowledge are appreciated.
-
@Alan-Kilborn said in Notepad++ "Projects" info:
I didn’t see anything in the user manual about it
I think that’s because there’s not much there. All I could find was the mention in the config docs, which doesn’t give any details as to what goes in that section. And I didn’t see anything on how to actually use it.
What we need is either for some expert to step forward and describe (in brief) how it works (with an explicit “you can quote me” statement, so we can
stealuse that description) – or put in a PR in the github repo. Or we need one of “us regulars” who, even though we’ve never used that feature, go explore it, and try to write up a brief description. I don’t know how helpful that would be…Side note: It seems tough to find things in the user manual, but that could just be me
I had never tried the on-site search for the usermanual. I don’t think I had even noticed its existence. But yes, that doesn’t seem the best search interface. I don’t know if it’s configurable or not (my guess is it’s bundled with the framework that Don and the others chose when setting up the new site, and i know nothing about it)
I thought of using
https://www.google.com/search?as_q=TERM&as_sitesearch=npp-user-manual.org
to search the manual. Or just going into the github repo and searching.“project” to, but the the View menu in Notepad++ already has “Project 1”, “Project 2” and “Project 3”
After 30sec of playing around, I am not convinced that “project” and “Project” mean the same thing. ;-) I think that “Project N” refers to “Project Panel N”, whereas “project” is a subfolder in a given “workspace”, which can be loaded into any of the “Project N” panels. But I didn’t try everything in that 30sec, so I could be wrong.
-
I went looking for info on github.
It appears that someone had some good ideas for enhancements related to “projects” HERE but they were never accepted into Notepad++. :-(
Still, looking at that may provide some insight into how “projects” currently work, and what they don’t currently support.
-
Hmm… @Uhf7 (from that issue) has posted in the Forum once… Unfortunately, he apparently hasn’t been back here since. I was hoping that my @-mention would flag him the next time he dropped by, and he would then volunteer to help describe the current behavior of the feature. (He must, after all, be an expert on the feature… or, at least, more expert than us. ;-) )
-
I created issue#131 to indicate that I need to work on that lack of documentation. A bit of websearch quickly found that the old NppWiki docs had a page on the feature, so I’ll work with that and some other stuff I found to try to get some docs written up.
-
@donho upvoted my post in some inconsequential thread! Interesting! :-)
-
In the following I try to provide some basic knowledge I’ve learnded while using the Projects feature of Notepad++. If you find parts of it worth to be included into the official manual you can do that, of course.
Notepad++ Projects Basics
Notepad++ can manage up to three project panels whose visibility can be toggled via
(menu) View -> Project -> Project Panel X
. A project panel can contain one workspace which can contain multiple projects. A project can contain files and folders that actually exist on the hard disk but it is also possible to add virtual folders to it.Once created, it is possible to save a project’s structure to a file. When Notepad++ is closed, it saves the last opened project file per project panel to its config file. The next time Notepad++ is started it loads these project files and populates the according project panel.
Project Files
The file name extension for project files is configurable via
(menu) Settings -> Preferences -> MISC. -> Workspace file ext.
. If an extension has been configured and such a file is opened with Notepad++, the project structure is loaded into Project Panel 1 (if the panel isn’t already populated with the content of another project). The other two project panels can only be populated by clicking on(project panel toolbar) Workspace -> Open Workspace
or by right-clicking the Workspace tree root node and selectingOpen Workspace
from the context menu.Project files are XML files that contain the configured (hierarchical) structure as XML nodes. Each node that represents a disk file contains the relative path of that file in relation to the project file itself. So, if the project file is stored in a directory whose files and/or subfolders are part of the project, it is very easy to move the whole directory structure to another location on the hard disk.
Differences Between Projects and “Folder as Workspace”
In contrast to the Folder as Workspace feature, projects are not bound to the content of a certain folder on the hard disk. Instead, it is possible to put together files and folders from various locations on the hard disk into one project. It is even possible to create folders in a project which actually don’t exist on the hard disk and add files from various locations to them. Long story short, with projects it is possible to combine files and folders into a totally virtual structure. This can speed up accessing files which are logically related to each other but are widely spread over the hard disk.
-
Hi, @dinkumoil,
Very explicative post, especially the difference between Projects and Workspace. Many thanks for taking the time to explain these concepts ;-))
BR
guy038
-
It confuses things somewhat that in the “Project” area we have the concept of a “workspace”, and, totally different, we have the “Project as Workspace” feature.
-
Poorly named, maybe. But not “completely different”, IMO: the Folder as Workspace behaves like a single Project Panel with its workspace automatically defined, except it’s tied to the Windows filesystem hierarchy, rather than being fully customizable.
(Personally, I think the “Project Panel” should be called “Workspace Panel”, since each “workspace” contains one or more “projects”. But at this late stage, I wouldn’t recommend renaming it.)Anyway, I did some offline work before I saw @dinkumoil’s description.
My thought was that I’d expand the Sessions documentation to “Sessions, Workspaces, and Projects”. My rough draft follows:
-----
Sessions, Workspaces, and Projects
There are three built-in “multiple file management” systems available natively in Notepad++.
- Sessions = a set of files that can be opened with one action.
- Folder as Workspace = a tree-based interface to easily access the files in a given Windows directory.
- Project Panels = a tree-based interface to access related files that aren’t necessarily grouped in the same Windows directory structure.
There are also various plugins available that might help manage sessions or workspaces, or serve similar purposes but with a different feature set compared to these built-in features.
Sessions
Sessions are a set of files to be opened in Notepad++. Using sessions, you can open a set of files with one action. They do not have to be in the same directory or even on the same drive.
The session file stores the paths of the open files, the active file (and which view, see the section about Multi-View), the current selection and position in the file, the current bookmarks (see Bookmarks) and the current language (see the section about Languages). When you load the session, all of that information is loaded back into Notepad++.
- File > Load Session… can be used to load an existing session.
- File > Save Session… can be used to save the currently-open files as a session.
Session files are XML, and are identical in format to the
session.xml
config file.
The MISC preferences include an option to set a file extension that will automatically be opened equivalently to Load Session, even if you use File > Open to access that session; that extension will also be the default when you Save Session¹.You can also load a session file using the
-openSession
command line argument.Folder as Workspace
This feature allows you to use a tree-based interface to easily access the files in a given directory. When you drag a folder from Windows Explorer onto Notepad++, this feature will be activated (unless overridden by the “… folder dropping” option).
You can also load a folder as workspace session file using the
-openFoldersAsWorkspace
command line argument.If you right-click in the Folder as Workspace panel, you can add more directories to the current workspace.
Double-clicking on a file from the tree-view will open it as a new tab in the Notepad++ editor (or will activate that tab if it’s already open). Closing the tab for a file from the project will not remove it from the Folder as Workspace panel, so it’s easy to re-open that file.
Project Panels
The project panels are similar to the Folder as Workspace panel, but allow you to organize the tree view to your liking, rather than being forced to follow the Windows filesystem hiearchy.
Double-clicking on a file from the tree-view will open it as a new tab in the Notepad++ editor (or will activate that tab if it’s already open). Closing the tab for a file from the project will not remove it from the Folder as Workspace panel, so it’s easy to re-open that file.
There are three Project Panels available from the View > Project sub-menu. The three Project Panels can be individually docked or floated.
In each panel, you can open one Workspace file. Using the Workspace button on the Project Panel, or right clicking on the workspace’s name in the tree view, you can perform a variety of actions, enumerated below. The MISC preferences include an option to set a file extension that will automatically be opened equivalently to the Open Workspace command, even if you use File > Open to access that workspace file; that extension will also be the default when you Save Workspace¹.
Each Workspace can house one or more Projects. Clicking the Edit button on the Project Panel, or right clicking on the project name, will give you administrative options for the selected Project, enumerated below. In each Project, you can select individual files or the contents of whole Windows Directories to be added to the project, and you can reorder the files. If you add a Folder to the Project, you are not creating a Windows Directory anywhere: you are creating a container inside the Notepad++ Project item; the files listed in a folder have not moved. To reiterate: Project Folders are independent of the filesystem, and are just hierarchical containers for this feature of Notepad++.
You can move a file into a Folder by dragging the file. Other than that, there aren’t other drag-and-drop features in the Project Panel.
For any entry in the Project Panel tree view, right clicking will give you the available actions on that specific entry.
- On a Workspace:
- New Workspace = close the existing Workspace (if one is open for this Project Panel) and create an empty Workspace for this Project Panel.
- Open Workspace = close the existing Workspace (if one is open for this Project Panel) and open the selected Workspace file.
- Reload Workspace = re-read the XML file for the active Workspace (it may have been edited externally).
- Save = save any changes in the projects, files, and folders of the active Workspace configuration.
- Save As = save the active Workspace in a new Windows filesystem location.
- Save As Copy = save the active Workspace in a new Windows filesystem location, keeping the old workspace file as well.
- Add New Project = add a new project container to the active Workspace.
- On a Project entry:
- Move Up / Move Down = reorder the selected Project relative to other Projects in the Workspace.
- Rename = change the name of the Project.
- Add Folder = create a new container to go in this Project.
- Add Files = use a Windows Open dialog to select one or more files to add to the Project’s tree.
- Add Files from Directory = add all the files from that Windows directory into the Project.
- Please note: this is not a recursive action: this just puts all the files in the list.
- Please note: this does not create a new Folder entry in your project.
- If you want a feature that automatically maps to the selected Windows directories, use Folder as Workspace instead
- On a Folder entry:
- Has all the same actions as on the Project entry, but everything is relative to this Folder instead of relative to the Project.
- On a File entry:
- Move Up / Move Down = reorder the selected file relative to other files or Folders in the containing Project or Folder.
- Rename = changes the name of the file in the list.
- This action does not change the underlying file.
- If the new name does not exist as a file, it will show a little error symbol on the file icon in the tree.
- If the new name does exist as a file, the old file will still exist but will no longer be a part of this Project.
- Remove = removes the file from the Project.
- This action does not change the underlying file.
- Modify File Path = similar to rename, changes the file in the list, but also allows you to change what Windows directory is being referenced.
- This action does not change the underlying file.
- If the new name does not exist as a file, it will show a little error symbol on the file icon in the tree.
- If the new name does exist as a file, the old file will still exist but will no longer be a part of this Project.
<hr>
Footnotes
<a name=“FN1”>¹</a>: if you set the Session or Workspace extensions, you will find it difficult to edit the XML for the given Session or Workspace file inside Notepad++. To do that, you can temporarily clear that preference setting, edit the file, then set the extension preference again.
-----
Let me know if you have comments or recommendations, or if you think I should incorporate more of @dinkumoil’s descriptions/phraseology.
-
I created a new branch in my npp-usermanual fork, so here is a link to the in-progress
session.md
source.Feel free to comment in issue#131 if you have more suggestions, or submit a PR to my fork/branch if you have specific changes that you think I should incorporate.
(For future readers: if/when the changes from this branch are incorporated into the master repo, or are rejected, the branch will be deleted and the above link will not work)
-
Hello, @peterjones, @dinkumoil, @alan-kilborn and All,
Personally, I would suggest that you insert, at the place you think most appropriate, the last part of the @Dinkumoil’s post, below, which clearly illustrates the fundamental difference between the two concepts of
Projects
andFolder as Workspace
!Differences Between Projects and “Folder as Workspace”
In contrast to the Folder as Workspace feature, projects are not bound to the content of a certain folder on the hard disk. Instead, it is possible to put together files and folders from various locations on the hard disk into one project. It is even possible to create folders in a project which actually don’t exist on the hard disk and add files from various locations to them. Long story short, with projects it is possible to combine files and folders into a totally virtual structure. This can speed up accessing files which are logically related to each other but are widely spread over the hard disk.
Cheers,
guy038
-
I haven’t experimented more with Projects, but reading your proposed documentation, I didn’t see the feature I’m most interested in.
If I “join” a group of files from very different locations on my computer together via a project, I want to be able to search the project files for certain text items. I want to be able to search only these files.
I really must experiment more myself before commenting further. :-)
-
@Alan-Kilborn said in Notepad++ "Projects" info:
I didn’t see the feature I’m most interested in.
I doubt what you described exists. But since Scott “likes” implementing search features, it would be worth putting in the feature request for a “Search in Project Files” option.
-
@PeterJones said in Notepad++ "Projects" info:
it would be worth putting in the feature request for a “Search in Project Files” option.
It seems the github link I provided before suffices for this, if it could be resurrected somehow.
I notice even “Folder as Workspace” has the ability to do searches (right-click a folder in that view, there’s a Find in Files… option).
Curious, though, what other advantages a “project” brings over using Explorer plugin and its favorites feature. Maybe “project” satisfies some requests for “pinning” files without using a plugin.
Not real questions, though, as I’ll be finding out. If I find interesting things, I’ll report back here.
-
So in advance of what looks like some activity on github for an addition of a “search in project” capability, I started some renewed experimenting with “projects”.
It seemed to go well. :-)
One thing I noticed: There’s an ability to rename a file in the project window. Normally a file just has the same name (without path) in the project window that it has on disk. I renamed a file to try this out, and it accepted my new name, but I don’t know what good it does, as double-clicking the new name doesn’t open the original file into N++ tab set. Additionally, in the project window it put a little
-
in a red circle as the file’s icon:Am I just missing the point of this type of renaming?
My original file had a cryptic name that I thought I could give a better “mnemonic” name to in the project view, obviously retaining the actual name on disk–because that is needed for other tools in the tools that handle the project–third-party tools, not N++'s tools.Ah, I see in the “hover” tip that it thinks the file is at a path that reflects the new name I gave it. But there is nothing there (because it doesn’t actually rename the disk file); that’s why double-clicking it does nothing – but I’m still a bit confused about this.
-
Looks like changing name in file item changes also it path. This not happend when we rename folder item. For me it looks like a bug, both the name for folder/file item in list is just a label (which can be changed) but the real source should be indicated by path.