Sublime Forum

Find in Files project setting?

#1

When I open a project I want the ‘Find in Files’ setting to be the same as it was last time I worked on the project. How do I do that? Can I do that?

0 Likes

Default search folders for Find In Files
#2

According to the official documentation, the “find in files” history isn’t stored in .sublime-project files. (although it has been known to be incomplete, in this case it seems to be correct - I just tried manually adding a "find_in_files": section, structure taken from the .sublime-session file, and it was ignored.)

However, it looks like it might get stored in the project’s .sublime-workspace file, though it isn’t possible to manipulate that while the project is open in ST, so it wouldn’t be possible to develop a plugin to store the project’s find in files state here.

So I think the answer is it’s not possible without removing/clearing the .sublime-session file so that the project’s workspace would take precedence?

0 Likes

#3

Workspaces usually do take precedence over the global session file and I am fairly certain that ST always properly remembers my project-specific search terms in find in files.

2 Likes

#4

Indeed there was a post recently involving the inverse of this: it kept persisting a value (in this case the where) field when the poor fellow did not want it to.:

In any case, like @FichteFoll it seems to remember project specific settings for me as well and I swap projects a lot.

By chance is it just the search text that is not getting saved? If so you might have find_selected_text turned on, which updates that field with the current selection when you open the panel.

While testing things out in the post above I discovered that the where field contents are not saved unless you actually run the search, so that might apply to the other fields as well. That would explain the problem if you were just entering values into the panel but not doing a search right away (which seems unlikely).

1 Like

#5

Thanks. When I look in the sublime-project file (which I have stored in the same folder as my project HTML/CSS/JavaScript folder), I see no mention of the ‘find in files’ info. However, the sublime-workspace file, which is in the same folder, includes quite a bit of search history, including the history of ‘find in files’.

So I guess the question now is whether a sublime-workspace file is created each time a sublime-project file is created?

0 Likes

#6

Whenever you open a project and there is no workspace file, it is created. You can, however, have multiple workspaces for one project (check the project menu).

0 Likes

#7

OK, so I guess the idea is to do at least one search and save a project, and thereby a workspace. That should allow one, upon reopening the project, to see the same setting for ‘find-in-files’ as one had before–or recall it in the ‘find in files’ history.

0 Likes