Menu

Find In Files

Trevor Williams
Attachments
find-in-files.png (7246 bytes)
find.png (8378 bytes)
in.png (12123 bytes)

Find In Files

It is often the case when editing project files that you need to find information in other files. Typically this involves switching to the command line and performing cd and grep commands and then finding/opening those files back in an editor. Nothing like performing a bunch of extra steps to pull you out of the coding zone…

For these types of operations, TKE has your back with its "Find in Files" feature. Just invoke it from the "Find / Find in Files" menu option and the following input panel is displayed.

[[img src="find-in-files.png" alt="Find In Files interface"]]

The "Find" entry field allows you to specify a search pattern to find within a group of files/directories. So if we wanted to find all occurrences of the keyword "foobar" at the beginning of a line (with optional spaces between the beginning of the line and the keyword), we could enter the following regular expression:

[[img src="find.png" alt="Performing regexp search in files"]]

After entering the TAB key, the input focus will rest on the search type which can be set to the following values:

  • Regexp
    • Performs a valid regular expression search
  • Glob
    • * character matches zero or more characters
    • ? character matches any single character
    • Any characters are placed within [] are specifically searched for (a range of characters can be specified if a - character is specified between the first and last.
  • Exact
    • Matches all characters exactly.

After entering the TAB key again, the input focus will reset on the case sensitivity switch. By default, the value of this switch is to search in a case sensitive mode. Hitting the TAB key again will perform case sensitive matching. Hitting the SPACE bar followed by the TAB key will change to case insensitive matching.

The "In" input field allows the user to enter one or more directories, files or specialized group of files to perform the search. Entering a value followed by the ENTER key will tokenize the current value. You can select one or more tokens in the field and hit the BACKSPACE key to delete the tokens or double-click one to change its value.

[[img src="in.png" alt="Specifying files/directories to be searched"]]

Entering a value in this field will display a dropdown list of matching files/directories that are accessible within the sidebar. Select a value in the dropdown list by using the UP and DOWN keys and hitting the ENTER key to select a value.

Once the desired directories/files have been entered, hitting the ENTER key one more time in this field will perform the file search. In a few moments, TKE will display a "Results" buffer which will display the list of matches along with some contextual information. All matches will be highlighted within the editor and left-clicking on any match will automatically open the associated file within the editor and jump to the matching line, placing the insertion cursor at the matching value.

The final checkbox, if checked, will remember the search pattern which can be accessed by using the UP/DOWN arrows when the cursor is in the Find field in subsequent Find In Files operations.


Related

Wiki: Tips & Tricks

MongoDB Logo MongoDB