-
Notifications
You must be signed in to change notification settings - Fork 1
Find & Replace
The ability to find some specific text in the contents of your file is always available as well as being able to replace a piece of this content for another.
You can find all related find and replace commands under the Edit menu, which are the following.
This command will show you a dialog when you press Ctrl + F or click the menu item Edit > Find.
Enter the the text you want to find in the text field and then click the Find Next button or press the Enter . When a match is found it will be selected and the cursor will move to the beginning of that selection.
By pressing the button or the Enter key again, Clojure Lab will search for the next match, if there is none the cursor will stay put.
A closely related command to Find is the Find Next. Once you close the Find dialog you will be able to repeat the search for the last term you entered there by pressing F3 or clicking the menu item Edit > Find Next.
Replacing text in a file works pretty much the same as finding it, the only difference is you also specify the text that will replace the original one. Activate this command by pressing Ctrl + H or cliking Edit > Replace.
To perform a replacement follow these steps:
- Enter the text that will be replaced in the Find field.
- Enter the replacement text in the Replace field.
- Press the Find Next button to find a match.
- If a match is found press the Replace button to apply the replacement and search for the next match.
Alternatively you can press the Replace All button which will perform a replacement for all matches. This is useful when you are sure that every ocurrence of the text should be replaced.
Since sometimes you need to find text in multiple files the Find in Files command lets you do just that. You will see the following dialog after pressing Alt + F or cliking the menu item Edit > Find in Files.
As in the previous commands, there is a Find field where you enter the text you need to find and there's also a Browse button in order for you to select a directory. The search will include all files in this directory and will also include all children directories if you choose to do so by activating the Recursive checkbox.
Once you have added all the necessary information, pressing the Find All button will open a tab in the lower section of Clojure Lab. In this tab you will find the results of the search in the form of a tree.
Each leaf in the tree is a match of the search, to open the file where the match was found, double-click the item. This will not only open the file (if it was not already open) but it will also move the cursor to the position where the match is located.