Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Open all files command to Folder as Workspace #3515

Closed
crypto-rsa opened this issue Jul 11, 2017 · 13 comments
Closed

Add Open all files command to Folder as Workspace #3515

crypto-rsa opened this issue Jul 11, 2017 · 13 comments

Comments

@crypto-rsa
Copy link

Description of the Issue

There is no way to open all files at once in a Folder as Workspace.

Steps to Reproduce the Issue

  1. Add some folders to the Folder as Workspace panel
  2. Right click on a folder in that panel

Expected Behavior

There should be a command Open all files.

Actual Behavior

There is no way to open all files in a folder at once.

Debug Information

Notepad++ v7.4.2 (32-bit)
Build time : Jun 18 2017 - 23:34:19
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS : Windows 10 (64-bit)
Plugins : ComparePlugin.dll HTMLTag_unicode.dll LocationNavigate.dll mimeTools.dll NppColumnSort.dll NppConverter.dll NppExport.dll NppFTP.dll NppTextFX.dll NppToolBucket.dll PluginManager.dll PythonScript.dll XmlNavigator.dll XMLTools.dll

@DanielTheGreat
Copy link

This issue was lodged in 2017, but there seems to have been no action towards implementing it.

I too would very much like to see this feature added to Notepad++.

A typical scenario for me is needing to work on a project (by others) that contains multiple sub-directories each containing multiple files (.c, .h, etc). In order to locate specific functions, variables, etc, using the 'Find in all open files', the files need to first be opened in editing tabs. Having to open a number of folders and drag dozens of files into the edit pane is a pain!

@sasumner
Copy link
Contributor

@DanielTheGreat It would probably add some strength to your argument (don't get me wrong, it isn't a bad request at all) if you could describe why Find-in-Files (with appropriate Filters) doesn't help in this situation.

@DanielTheGreat
Copy link

@sasumner I'm only a casual user of Npp, thus not familiar with many of its features. I had not used Find-in-Files before, but tried it on your suggestion. I struck a few (minor) problems, which (for me) make it a little slower (more steps) to achieve the desired result compared to 'Find in all open files'...

Firstly, when initiating FiF, rather than defaulting to the currently-open 'workspace', it defaults to some ancient directory I must have used eons ago. So I first had to navigate it to my workspace directory. When I then just clicked 'Find all' (no filter), it found 20 instances of my function name, only four of which were in .c or .h files.

Then I tried what seemed like a logical filter term: '*.c, *.h', but it only returned the one instance in a .h file. Obviously the filter syntax is not 'intuitive' (or flexible regarding term separators – after reading the (old version) manual I find it's only spaces that will work).

But yes, FiF can help me a lot. Thanks for alerting me to it.

@sasumner
Copy link
Contributor

@DanielTheGreat

There's a "Follow current doc" checkbox. Tick it. Then FindInFiles won't default to an "ancient directory", it will default to the dir of the file you are currently editing.

Space separation of multiple filespecs for a filter is as "old as the hills", not only in Notepad++ but in many many other programs. Granted, with spaces being allowed in filenames these days, maybe this "standard" way of doing it could use some new thinking.

@DanielTheGreat
Copy link

@sasumner Thanks for the further usage pointers, but that doesn't solve the problem...

Some 'workspaces' contain multiple sub-directories, a common directory structure (e.g. for Renesas e2studio projects) including 'Includes' and 'Source'. So if I'm in a .c file (in Source sub-directory) and want to find all references to a particular function, ticking the 'Follow current doc' checkbox will only search other files under 'Source', and miss all the .h files in 'Includes'.

Daniel

@sasumner
Copy link
Contributor

So the "follow current doc" suggestion was only meant to get you a lot closer to the needed directory than without it (I'm thinking the "ancient directory" mentioned before was way-far away!). Perhaps you'll need to delete off the right part of the dir once the FindInFiles box appears and populates the dir to search box, to do your "upper-level" search.

I'm sure there are other things that help as well. Perhaps maintaining a session with all of your possible files already open is a help.

And please note, these suggestions are just meant to ease your pain before someone can look into making a source code change per your original suggestion.

@DanielTheGreat
Copy link

Yep, understood. And I do appreciate all your suggestions, which will certainly 'ease my pain'!

Note that it wasn't "my" suggestion – I just seconded the original suggester (crypto-rsa)'s request (though I'm sure many other users have also longed for this improvement). Note that crypto-rsa's request for an 'Open all files' command is often too broad. In the case of a Renesas project, that would open all sorts of useless (to me!) .xml and other 'project housekeeping' files. I'd really like to see the 'Open all files' command come with a filter facility (like FiF) so that I could, for example, just open all *.c and *.h files in a workspace (all sub-directories).

Daniel

@donho
Copy link
Member

donho commented Dec 29, 2019

It's kind of over-killed feature to me and I am likely to not implement this feature.

@donho donho closed this as completed Dec 29, 2019
@crypto-rsa
Copy link
Author

I have a folder in Folder as Workspace with 16 XML files which I very often work with. So before I start, I need to:

  1. right-click the folder
  2. click Copy path
  3. click Open
  4. paste the folder path
  5. click Open (that opens the folder in the open dialog)
  6. select all files
  7. and finally click Open

Surely a single context menu command is not an over-killed way to achieve this. If FaW is meant to streamline working with common files and folders, shouldn't this actually be one of its basic features?

@CmsWares
Copy link

I'd like to voice support for adding in the "Open All Files" option for Folder as Workspace. Typical use case is, I have several instances of NP++ open, each with files from a particular set of related code, typically everything inside a given folder.

Saving and loading sessions or other "tailoring" solutions isn't really a solution, because I really can't be bothered creating and chasing sessions for each possible case. It would be much simpler to simply click "Open All" from the relevant folder.

There's already functionality for opening all files in a folder in the CLI, where notepad++.exe c:/codes/some/dir opens up NP++ with all files in the given directory opened. Can't this simply be mapped to an option in the right-click menu?

@CmsWares
Copy link

CmsWares commented Jan 17, 2022

OK so I officially got tired of opening all-files-per-directory all over again. Here's a quick fix using the PythonScript plugin. (Fifteen minutes well-spent for future hours saved, will do until a built-in update on this hopefully emerges.)

  1. Create a new script, e.g. OpenCurrentDirFiles.py:
import os, glob

dirName = os.path.dirname(notepad.getCurrentFilename())

# change to match any files - or match by current extension:
# extFilter =  '.*' # get any files
extFilter = os.path.splitext(notepad.getCurrentFilename())[1]

def readFiles(dirName, extFilter):
	for filePath in glob.glob(dirName + '\\*' + extFilter):
		notepad.open( filePath )

if dirName != '':
	readFiles(dirName, extFilter)
  1. Map to shortcut, e.g. CTRL+ALT+SHIFT+O. (Clear the conflicting "Open in Outlook" shortcut!)

  2. Open any file in your desired target folder.

  3. Hit the shortcut. All files with matching extension in that folder are opened. Modify the extFilter pattern as needed. Probably don't use the *.* filter if you have binary files mixed in.

  4. Enjoy the decrease of wear on your buttons, your fingers, and your mind.

@alankilborn
Copy link
Contributor

@CmsWares

While I'm all for a script, why not simply do Ctrl+o, click once in the area where the filenames for the folder are shown in the Open window that appears, press Ctrl+a, then press Enter?

@CmsWares
Copy link

CmsWares commented Jan 23, 2022

@alankilborn ha right that would get the job done. It's four actions vs. one though, doesn't quite sizzle like a one-move hotkey script. If I save 6x5 sec daily with this, it's three hours in a year. Discovered an interesting side-effect though. When in a blank tab, the script tries to open everything in C:\ because the current path is empty, so. Sizzles hard, system freeze. Must have tried to open pagefile.sys huh. Updated the code to match...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants