Perform Search on Whole Directory in Sublime Text 2? - sublimetext

Is there any directory-wide search functionality in Sublime for the directory currently opened in the editor?
Or optionally a search all opened files? (If this exists do the files have to be opened in a tab or just visible on the sidebar?)

Yes there is.
On Windows
CTRL + SHIFT + F
On Macintosh
CMD + SHIFT + F
The Where field in the search panel determines where to search. You can define the scope of the search in several ways.
More: https://docs.sublimetext.io/guide/usage/search-and-replace.html

In Sublime Text 3
Right click on FOLDERS Navigation bar
Choose Find in Folder

*/folder_name/*
In the "Where" section of the find-all dialogue (CtrlShift+F or ⌘Shift+F ), */folder_name/* will search folders called "folder_name" that are represented in your current session. For instance, if you have a file open with a path of C:\Users\joe\folder_name\file.js, you can use the *//* pattern to search any of those folders or combinations of folders: */joe/* and */Users/joe/* will both work. However, if you have a file like this C:\Users\timmy\folder_name\file.js that's not open, it won't search that (unless you explicitly name it, like in the next example).
C:\path\to\folder
You can also put in the absolute path to the folder you want to search. This is useful if you want to search a folder that is not represented in sublime (no files within that folder are currently open in sublime), or if you have two dirs with the same name, and you only want to search one. Personally, I never use this.
C:\path\to\folder, */folder_name/*
You can also combine them.
To answer your last question, at some point Sublime started automatically searching all open files and represented folders, but if you want to be sure you can use one or all of these variables:
<project>,<current file>,<open files>,<open folders>
You can read more about searching at the unofficial sublime documentation. Or from this post, which is similar to your own.

Related

Sublime Text 3 Show capitalized folders on top

Is it possible to sort the folders in the sidebar in a way, that shows capitalized folders on the top?
The folders are shown in the order they are listed in the project. You can rearrange them as you see fit. Nothing built in, but you write a script to modify the sublime-project files so they look like what you want.

Project wide word matching search on Xcode 5

I'm using Xcode 5, and want to find a word (ex:variable name) not by substring match but by exact match (or prefix match). In file wide search (Command-F), I can use Textual search or regular expression search by clicking the arrow button just right of the glass icon and choosing "Edit Find Options...".
But, I cannot find any option to search on project wide search ("Find in Project", Shift-Command-F), in Xcode 5.
One thing I can do is run "grep -w" on Terminal.app. But, isn't there any way to search word in Project inside Xcode?
Well it seems that the search tool in Xcode 5 is a bit confusing for a lot of people. In my opinion Apple should have done a better work letting the user know of what is clickable and what not... That being said, here is how you access the different options:
Once we switch to the Find Navigator we see 3 components (Find>Text>Containing)
Now, you can click on any of them to select between different options (à la jumpbar)
And finally you can also click the In Workspace (or In Project) to change the scope of your search
In Xcode 6 the problem I was having was that my Framework folder wasn't being searched, even though it was clearly part of the project (but in /Library/Frameworks), and even when I had one of its files open with the string showing in the editor.
Changing the scope from In Project to My Scope (as shown) even allowed me to find the search string in non-frameworks folders.

Are these NotePad++ features available in TextMate?

I'm a NotePad++ user, new to TextMate.
There are some features that I really like in NP++ but couldn't figure out if TextMate support them.
Double click on a variable and have all instances highlighted
View 2 text windows side by side
Drag a file onto another opened Window
For this one, I don't know how to generate a screenshot ;-p. Basically, you can drag a file from Windows Explorer and drop it into NP++ to have it opened.
A lot of long time TextMate users are leaving TextMate land, actually. So, I'm not sure it's the right time to move to TextMate.
Emacs and Vim both do what you want and more. If you can afford the learning curve it's definitely worth it.
As for your question:
View 2 text windows side by side
You can have two or more windows for the same document. Assuming you are in a "project" right-click your file in the drawer and choose Open "foo.ext" in New Window. The two "views" contents are more or less in sync but doing cool things like columnar editing tends to break the syncing.
Due to how Mac OS X manages windows, the new window will probably be too large/too small and/or placed in a less than useful place. I use ShiftIt system wide to manage my windows and in such a case have them the same size side by side.
Double click on a variable and have all instances highlighted
What do you use this for? Is this visual highlight or non-contiguous selection?
Type ctrlw to select the word, then ⌘e to make the word your search term, then ⇧⌘f or Edit > Find > Find in Project… It will show all instances of the search term in another window. You can then "jump" to any occurence and do whatever you want.
If you only want to jump from occurence to occurence, select the word then type ⌘e then ⌘g to jump to the next occurence.
Another way is to type ctrls, a little text field appears at the bottom of your window where you can type a word and see its first occurence selected in real time. Repeatly typing ctrls will cycle through the occurences.
Drag a file onto another opened Window
You can drag & drop a file on TextMate's icon in the Dock. You can also right-click the file and choose Open with TextMate *or Open with…*. If you are in a "project" you can right-click and choose Add Existing Files…. Opening multiple files in TextMate will automatically create a "project" for you.
View 2 text windows side by side
I just tried this and it doesn't seem to recognize this functionality. the only time any sort of "add" icon came up was when I dragged the file into an open document and then released, but that resulted in adding the contents of the file into the document.
I just did a quick google search for "textmate split view" and it still doesn't seem to be supported according to some of the answers i found (one from macromates wiki).
Double click on a variable and have all instances highlighted
This also doesn't seem to be supported. This post suggests using the command + f (find), put the word into find, then command + g to jump to the next instance of that word.
There are definitely some things that can be added to textmate to make it more robust. If you are looking for something similar and are on a windows machine, you should check out e text editor. I loved that editor when I was working on a windows machine - split view is supported, but not sure about the highlighting. One thing that e also beats out textmate is the real time regular expression highlighting.

Searching in Xcode not finding results (searching my source)

I'm pulling my hair out on this and Google results are skewed since it thinks I want to find out how to code something.
My problem is that when trying to search my code with the String Matching box it finds nothing, even if I enter something that is on the screen below.
Is it Spotlight that is delivering these results? I'm not excluding anything in my Spotlight index so should I just rebuild the index?
At the top of the Xcode search field, you probably want to select:
Find > Text > Containing
rather than any of:
Find > Text > Matching
Find > References > Matching
Find > References > Containing
I did not (knowingly) switch this to "Text Matching" or "References", but there it was set. "Text Containing" is a more useful search type for most searches.
This happens to me after doing this: from editor, select a word, then right-click on it, then choose "Find Selected Symbol in Workspace".
As a consequence, the finder automatically sets itself to:
Find > Reference > Containing
To search for a given text, you have to re-set it to:
Find > Text > Containing
Sometimes this happens to me when the "In Selected Items" is selected in the combobox on the right side of the search string.
If this selected, you only get a search in whatever files are selected in your project window. Change it to "In Project" to search all your source files.
Note that the files need to be inside of your current Xcode project (just opening them from the finder won't add them.) You may also be interested in the "In Open Files" option, which is faster for large projects.
Even with all filters disabled as described in previous answers, Xcode still doesn't always find all occurrences of a string in some of my projects, even though these occurrences are reached just fine when choosing Jump to Definition.
To do a literal full text search (note, this is much slower than the pre-indexed search), you can create a Search Scope that just searches the full project folder, by adding a Folder location in the Scope editor:
I got stuck on this one because I didn't realize that I had to hit RETURN to see the search results, haha. Normally the results changes dynamically as you write, but Xcode 11 apparently doesn't have that feature yet.

Fastest way to "jump back" to a file in TextMate?

Often, when I am reading code or debugging, I want the ability to quickly jump around files. I especially want to "go back" to where I was. I know about "Command+T", "Command+Shift+T", and, bookmarks. But, I cannot figure out a way to jump around files quickly.
UPDATE: I do not think I my question was clear enough judging by two answers given. Specifically, I am looking for a way to "jump back" to where I was in a file. I know how to navigate in TextMate (in general). I want to know if TextMate has a "jump back" key binding.
It's subtle.
The command-T thing has the files listed in Most Recently Used order.
So, you can go command-T return to get back to your last file real quick. At first I couldn't find it either.
I don't think there's a go to last edit location as there is in, say, IDEA/RubyMine.
Courtesy of MacroMates.com
2.3 Moving Between Files (With Grace)
When working with projects there are a few ways to move between the open files.
The most straightforward way is by clicking on the file tab you need. This can also be done from the keyboard by pressing ⌘1-9, which will switch to file tab 1-9.
You can also use ⌥⌘← and ⌥⌘→ to select the file tab to the left or right of the current one.
It is possible to re-arrange the file tabs by using the mouse to drag-sort them (click and hold the mouse button on a tab and then drag it to the new location). This should make it possible to arrange them so that keyboard switching is more natural.
One more key is ⌥⌘↑ which cycles through text files with the same base name as the current file. This is mainly useful when working with languages which have an interface file (header) and implementation file (source).
When you want to move to a file which is not open you can use the Go to File… action in the Navigation menu (bound to ⌘T). This opens a window like the one shown below.
Go To File
This window lists all text files in the project sorted by last use, which means pressing return will open (or go to) the last file you worked on. So using it this way makes for easy switching to the most recently used file.
You can enter a filter string to narrow down the number of files shown. This filter string is matched against the filenames as an abbreviation and the files are sorted according to how well they match the given abbreviation. For example in the picture above the filter string is otv and TextMate determines that OakTextView.h is the best match for that (by placing it at the top).
The file I want is OakTextView.mm which ranks as #2. But since I have already corrected it in the past, TextMate has learned that this is the match that should go together with the otv filter string, i.e. it is adaptive and learns from your usage patterns.
If you have a project window open, you can leave frequently-accessed files open (in tabs), and then use ⌘+1-9 to jump to open tabs.

Resources