Hide files/folders on my search but not in my side bar - search

I'm using sublime text 3 and I want to exclude files/directories but not in my sidebar.
For example...
I have those files:
/doc/blabla/event.rb with the text some content in it.
/app/event.rb with the text other content in it.
So, with Ctrl + P (find files) and writing "event" I want to see only /app/event.rb.
and, with Ctrl + Shift + F (find in all files) and writing "content" I want to see results, again, only for /app/event.rb
I configure sublime with this values into my Preferences.sublime-settings:
"folder_exclude_patterns": ["doc"],
this works beautifully but, it hides doc directory from sidebar too. I don't want this behavior. I only want to hide files from my search

For me, using Sublime 3 build 3083 binary_file_patterns was not working while I had the setting in the project.sublime-project file. Once I moved it to my Preferences.sublime-settings and added an '*' to the search it started excluding the folder from search results while leaving it in the sidebar. My Preferences.sublime-settings looks like so:
"binary_file_patterns":
[
"public/bower_components/*",
"public/javascripts/vendor/*",
"public-built/*"
],
and it works beautifully for me in sublime 3.
Also talked about in this post:
http://blog.lysender.com/2014/08/sublime-text-exclude-files-or-directories-from-go-to-anything-feature/

You aren't looking for folder_exclude_patterns, rather binary_file_patterns. Check the default settings for the current values in case you woul dlike to keep the default values. I don't know if it works on folders, so you'll have to try it out.

I have stumbled upon the same problem. Recently I've been trowing every project that I'm not currently working to a .old folder and it became really annoying as the suggestions of Sublime are ordered it always in first place, so I did the same as #Typenine suggested and put it in binary_file_patterns. It is working great:
"binary_file_patterns": ["*/.old/*", "*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"]

Related

How to show binary files in Sublime Text Folder View

I'm using Sublime Text 3 to write C libraries. I want to be able to reference the lib build directory, and see that a binary actually got built. However, Sublime shows the directory as empty.
How can I make the library binaries visible in Sublime Text Folders view?
What is and is not displayed in the side bar is controlled by the following two settings along with one additional setting to keep in mind (shown here with their default values):
// folder_exclude_patterns and file_exclude_patterns control which files
// are listed in folders on the side bar. These can also be set on a per-
// project basis.
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "*.sublime-workspace"],
// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
The folder_exclude_patterns automatically blocks a list of folders from appearing in the side bar (here the control directories for version controls systems) while file_exclude_patterns does the same for files and includes among other things compiled object files and library files for several platforms.
In order to have them appear in the side bar, you need to modify the file_exclude_patterns default so that the files you want to see aren't listed.
If you do that, the files will show up in the side bar, but they'll also show up in the list of files to open when you use Goto Anything or when you search in your project.
To fix that, you need to add any files that you remove from file_exclude_patterns to binary_file_patterns so that Sublime knows that they're binary and thus not interesting.
To tweak the settings, use Preferences > Settings, then copy the defaults from the left pane to your custom settings on the right, and modify the versions on the right.
Make sure you don't just create new settings without copying the defaults, or you're effectively turning off all of the default excludes, which will probably cause you issues down the line.
The Default preferences for ST3 contain:
// folder_exclude_patterns and file_exclude_patterns control which files
// are listed in folders on the side bar. These can also be set on a per-
// project basis.
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db", "*.sublime-workspace"],
// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
if you copy this into your user preferences, and move the file types you want to show in the sidebar from file_exclude_patterns to binary_file_patterns, then they will be visible in the sidebar, but still ignored for Goto Anything.

Unable to search Sublime editor folder files

I am new to Sublime, used to using Dreamweaver as my web editor. I have my project folder open in the Sublime Text 3 and I need to search all the files for a particular link https://test.com. From what I found on the web I need to hit Shift+Ctrl+F, enter my search string and then in Where: type the folder path I want to search. I have done that but the result set is empty even though I know the string I am searching for is there multiple times.
I tried entering the full path: W:\Web\App1 (where App1 is the folder I have opened as the project folder) as well as App1 but nothing gets returned. What am I doing wrong here?
Similar to Ctrl+Shift+F, you can right-click on the folder you want to search in, then choose 'Find in Folder'
In the bottom 'Find' box, make sure to have the 'Find options buttons' (on the left of the image) correctly set.
This is a very powerful option I use very often. Now I've tested in my SublimeText3 to look for an url like the one you provide and it works fine, as usual. With this setup:
Regular Expression: Off, Case Sensitive: Off, Whole Words: Off
...but this options are pretty straightforward and shouldn't affect your basic searches.

How to search only in currently open files in vscode?

I usually work on larger projects with many files that would contain the search query. So I would open the files I want to modify and do a find/replace across all currently opened files. Can this be done in vs code?
The feature I'm looking for is implemented in Notepad++, but I'd prefer not to have to switch editors for this task.
For me somehow it works just by typing ./ in the files to exclude field.
The ability to search only in the open editors is in the Stable Build v1.55.
As you can see, the icon is at the end of the files to include input so you will have to have that showing (click the three dots ... just below the search options if files to include is not already showing).
"Search: target particular set of files #20530" located here: https://github.com/Microsoft/vscode/issues/20530
Is tracking a search "scope" such as "all open files".
Hit Ctrl + Shift + F and enable the icon at the end of the 'file to include' text field
I don't think there's a way to do this. You can make a feature request on github. I think an extension could do it though.
There is a checkbox for this in the "files to include" field since version 1.55 (march 2021).
The answer was already mentioned (and accepted above) indeed typing ./ in the files to exclude box of the search window will allow you to only search in open files.
However the response mentioned that he was unsure why this worked. VSCode allows you to exclude all files in a directory by writing the directory in the exclude box. The directory . is the directory where VSCode is opened ie the root directory. The filter ./ excludes all files in the VSCodes root directory so all files are excluded. However opened files ignore any exclude filter. So if you exclude all files only the opened files will be searched.
The best way to find something you are searching for within a specific file in vs code would be:
Ctrl + p then pressing # on the search bar.
It will give you a list of all functions on the file, which makes it easier to track something down.
As an alternative to using Visual Studio Code itself, you can just search the file contents within the folder where unsaved files open in Visual Studio Code are located. This would be in one of these locations depending on which OS you are running:
Linux: /tmp/ (someone else running Linux can verify this)
macOS: ~/Library/Application\ Support/Code/Backups/
Windows: %APPDATA%\Code\User\
This extension is what I use for this purpose.
You may need to change the keybinding if there is a conflict.

How can I show dotfiles in Textmate 2?

I recently upgraded to Textmate 2 and now my dotfiles are not showing up in the file browser. Obviously, this is important when working with stuff like .htaccess files.
Is there a way to enable this feature?
Quick solution
Move the focus to the file browser (⌥⌘⇥) and show invisibles (⌥⌘i)(key names: option/alt+command/windows+i/eye). All invisible files will appear in the file browser. Press ⌥⌘i again to hide them.
Permanent solution
If you want to always show some dotfiles (for instance .htaccess), you can either add them in Preferences > Projects > Include files matching…
or add the list of files you want to show to the include array in one of:
~/Library/Application Support/TextMate/Global.tmProperties (same as using Preferences)
~/.tm_properties (global)
.tm_properties (inside a specific directory/project)
You can add all dotfiles (.*) but I don't recommend it since it can be a lot of clutter.
That said, you can also exclude files with the exclude array.
You can modify the behavior of the file browser via the config file ~/.tm_properties
To list all dotfiles and directories, you can set:
include = "{$include,.*}"
If you want to exclude some of those, for example the .git directory, modify the exclude variable:
exclude = "{$exclude,.git}"
There are many more options, check the Textmate site as an entry point for whats possible: http://blog.macromates.com/2011/git-style-configuration/
You can do this in the preferences of Textmate 2.
Navigate to: Textmate -> Preferences -> Projects. You should see two fields, one for including files, and one for excluding. I replaced the value of "Include files matching" with {*,.*} so it includes all normal and hidden files. I then just add the hidden files I want to exclude to the "Exclude files matching" field, such as .git and .DS_Store.

In Sublime Text, how do I find and replace the file name

Is there a way in sublime text where I can find a pattern and replace it with file names.
For example,
I have a bunch of file names that contain people.
I want to replace that with person.
in SideBarEnhancements there is an option to Mass Rename Selection... under Find Advanced to batch rename multiple files.
Menu: Find -> Find in Files...
Sublime is gonna open a new panel at the bottom, you just need to fill the fields. Inside the field Where, you can, for example, look up only for .txt files:
Find: People
Where: C:\Temp, *.txt
Replace: Person
No you cannot do a find and replace on a filename. Although there is a great package called SideBarEnhancements which would benefit from this feature. I will definitely submit a feature request.
Install the SideBarEnhancements plugin
Select the folder from side bar
Right click and open the context menu
From Find Advanced -> Mass Rename Selection... you can do this.

Resources