Skip to content

Commit

Permalink
Fix Issue atom#500
Browse files Browse the repository at this point in the history
-Added examples of glob patterns separated by commas to enter in the 
“File/Directory pattern" text box including an example of how to limit a 
search to the subset of files described in Issue atom#500 (restrict the 
search to files in the project with the .tpl, .php,  or .htm file type). 

-Inserted a link to a new image ‘find-replace-project-glob-pattern.png’ 
and this image shows how to execute the search described in Issue atom#500.

-To make the page more scannable, added ‘Search Within a Buffer’ and 
’Search the Entire Project’ subheadings (unrelated to Issue atom#500).
  • Loading branch information
jaret-basden committed Jul 29, 2019
1 parent 6d24351 commit 052fb86
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion content/using-atom/sections/find-and-replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ If you launch either of those commands, you'll be greeted with the Find and Repl

![Find and replace text in the current file](../../images/find-replace-file.png "Find and replace text in the current file")

#### Search Within a Buffer

To search within your current file you can press <kbd class="platform-mac">Cmd+F</kbd><kbd class="platform-windows platform-linux">Ctrl+F</kbd>, type in a search string and press <kbd class="platform-all">Enter</kbd> (or <kbd class="platform-mac">Cmd+G</kbd><kbd class="platform-windows platform-linux">F3</kbd> or the "Find Next" button) multiple times to cycle through all the matches in that file. <kbd class="platform-all">Alt+Enter</kbd> will find all occurences of the search string. The Find and Replace panel also contains buttons for toggling case sensitivity, performing regular expression matching, scoping the search to selections, and performing whole word search.

If you type a string in the replacement text box, you can replace matches with a different string. For example, if you wanted to replace every instance of the string "Scott" with the string "Dragon", you would enter those values in the two text boxes and press the "Replace All" button to perform the replacements.
Expand All @@ -24,13 +26,17 @@ When doing a regular expression search, the replacement syntax to refer back to

{{/note}}

#### Search the Entire Project

You can also find and replace throughout your entire project if you invoke the panel with <kbd class="platform-mac">Cmd+Shift+F</kbd><kbd class="platform-windows platform-linux">Ctrl+Shift+F</kbd>.

![Find and replace text in your project](../../images/find-replace-project.png "Find and replace text in your project")

This is a great way to find out where in your project a function is called, an anchor is linked to or a specific misspelling is located. Click on the matching line to jump to that location in that file.

You can limit a search to a subset of the files in your project by entering a [glob pattern](https://en.wikipedia.org/wiki/Glob_%28programming%29) into the "File/Directory pattern" text box. For example, the pattern `src/*.js` would restrict the search to JavaScript files in the `src` directory. The "globstar" pattern (`**`) can be used to match arbitrarily many subdirectories. For example, `docs/**/*.md` will match `docs/a/foo.md`, `docs/a/b/foo.md`, etc. You can enter multiple glob patterns separated by commas, which is useful for searching in multiple file types or subdirectories.
You can limit a search to a subset of the files in your project by entering a [glob pattern](https://en.wikipedia.org/wiki/Glob_%28programming%29) into the "File/Directory pattern" text box. For example, the pattern `src/*.js` would restrict the search to JavaScript files in the `src` directory. The "globstar" pattern (`**`) can be used to match arbitrarily many subdirectories. For example, `docs/**/*.md` will match `docs/a/foo.md`, `docs/a/b/foo.md`, etc. You can enter multiple glob patterns separated by commas, which is useful for searching in multiple subdirectories or file types. For example, `docs/a/*.md,docs/b/*.md` will match `docs/a/foo.md`, `docs/b/foo.md`, etc., and `*.tpl,*.php,*.htm` restricts the search to TPL, PHP, and HTM files throughout your entire project.

![Find and replace text in your project using multiple glob patterns separated by commas](../../images/find-replace-project-glob-pattern.png "Find and replace text in your project using multiple glob patterns separated by commas")

When you have multiple project folders open, this feature can also be used to search in only one of those folders. For example, if you had the folders `/path1/folder1` and `/path2/folder2` open, you could enter a pattern starting with `folder1` to search only in the first folder.

Expand Down

0 comments on commit 052fb86

Please sign in to comment.