How to only show files from file extensions in a whitelist in a Workspace?
WolfyRed last edited by
How do I only show files from file extensions in a whitelist in a Workspace? Like, maybe only show “.txt”, “.text” files in the Workspace.
Alan Kilborn last edited by Alan Kilborn
It isn’t possible.
I suppose you could put differently extensioned files into different projects within a workspace, and then collapse some projects and uncollapse other, but this might not be suitable to you.
Oh, wait…maybe you mean Folder As Workspace? I was thinking of “Projects” type workspaces (N++ makes the nomenclature confusing in the project/workspace/folder-as-workspace arena).
If you mean FAW, then really there is no way to do what you want.
Mark Olson last edited by
This post is deleted!
Mark Olson last edited by Mark Olson
If you’re talking about Folder as Workspace, then yeah, I don’t know a good way to do this. If you want a workspace that contains one or more folders and you want to hide files in that workspace, I suppose what you could do would be to export the workspace to an XML file, and then edit it with find/replace to comment out the files you don’t want.
Relevant documentation is here for discussion of project panels and here for discussion of searching the project panel.
Suppose I have a folder like this:
C:\\silly: - foo.txt - bar.xml - baz.txt - quz.py
Creating a project panel
I go to
View->Project Panels->Project Panel 1(assuming you don’t already have a Project Panel 1).
You should get a sidebar that looks like this:
Right click the thing that says
Add New Project. Now the sidebar will look like this.
Project Nameand select
Add Files from Directory...(not
Add Folder. Yes, this is confusing). Add the folder of interest. I selected
C:\\sillyfrom the folder browser dialog and now my project sidebar looks like this:
Workspace->Save As...and save your workspace as an XML file.
Excluding some files from your project
Now open up the project’s XML file in Notepad++. It will have the following contents:
<NotepadPlus> <Project name="Project Name"> <File name="C:\silly\bar.xml" /> <File name="C:\silly\baz.txt" /> <File name="C:\silly\foo.txt" /> <File name="C:\silly\quz.py" /> </Project> </NotepadPlus>
Now find/replace in this file.
txt|xmlcan be any
|-separated list of file extensions you want to exclude, like
txt(for just txt files) or
py|md(for Python and Markdown files).
<!-- \1 -->.
Regular expressions on
Now the file will look like this:
<NotepadPlus> <Project name="Project Name"> <!-- <File name="C:\silly\bar.xml" /> --> <!-- <File name="C:\silly\baz.txt" /> --> <!-- <File name="C:\silly\foo.txt" /> --> <File name="C:\silly\quz.py" /> </Project> </NotepadPlus>
Now save this file and close Notepad++ then reopen Notepad++. You need to close and reopen because Notepad++ doesn’t save the association between the project panel file and the project panel until it closes.
You should now find that the Project Panel will no longer show any
If you later decide you want to uncomment only XML files so that those are revealed in the workspace, you can do that by find/replacing
(?-si)<!-- (<.*name="[^"]*\.(?:xml)"(?:(?!/>).)*?/>) -->with
\1(regular expressions on). Then your project file will look like
<NotepadPlus> <Project name="Project Name"> <File name="C:\silly\bar.xml" /> <!-- <File name="C:\silly\baz.txt" /> --> <!-- <File name="C:\silly\foo.txt" /> --> <File name="C:\silly\quz.py" /> </Project> </NotepadPlus>
Using Find in Projects to search only some files
One way to make life easier would be to use the
Find in Projectsfeature of the find/replace dialog to search your project. You just go to
Workspace->Find in Projects...from the project panel, and the
Find in Projectsdialog will pop up. See the documentation here.
Suppose I wanted to restrict my search to
xmlfiles. That’s what the
*.txt *.xmlis doing.
If you search, a bottom bar will pop up in Notepad++ showing your search results.