AppCode 2017.2 Help

Finding and Replacing Text in Project

Introduction

AppCode extends search and replace capability to the entire project, or any directory with its nested hierarchy. Explore search results in the preview tab or in the Find tool window.

Finding a piece of text in all the files within the specified path

  1. On the main menu, choose Edit | Find | Find in Path, or press ⌃⇧F.
  2. In the Find In Path dialog, specify the following options:
    • Start entering the text. Type the text explicitly, or specify a pattern using a regular expression, or select a previously used piece of text or a pattern from the recent entries' drop-down list.

      If you specify the search pattern through a regular expression, use the $n format in back references (to refer to a previously found and saved pattern).

    • Search scope (project , directory, or custom scope).
      /help/img/idea/2017.2/search_scope.png
    • Search options (case sensitivity, whole words, and regular expressions).
      /help/img/idea/2017.2/search_options.png
    • Context search options.
      /help/img/idea/2017.2/context_search.png
    The results are displayed in the preview area.
  3. Edit the selected result right in the preview editor as it is a functional editor where actions such as Find ⌃F or Find Next F3 are available without leaving the Find in Path window.
    /help/img/idea/2017.2/find_in_path_preview_editor.png
    Press Enter to open the selected result in the editor.
    Click Open in Find Window ⌃⏎ to see all of the results in the Find tool window.

Replacing a piece of text in all the files within the specified path

  1. Do one of the following:
    • On the main menu, choose Edit | Find | Replace in Path.
    • Press ⌃⇧R
    • Being in the Find In Path dialog box, press ⌃⇧R to switch to Replace In Path dialog box.
  2. In the Replace In Path dialog, specify the search and replace strings, the search options, and the scope. Type the search and replacement text explicitly, or specify patterns using regular expression, or select a previously used piece of text or a pattern from the recent history drop-down list.
    • If you specify the search and/or replacement text through a regular expression, use the $n format in back references (to refer to a previously found and saved pattern).
    • To use a backslash character \ in a regular expression, escape the meaningful backslash by inserting three extra backslashes in preposition: \\\\.
  3. Click Replace in Find Window. AppCode displays the encountered occurrences of the search string in the Find tool window, selects the first occurrence and opens the file with this occurrence in the editor and moves the focus to it.

    At the same time, AppCode opens the Replace Usage dialog box, with the full path to the encountered occurrence in the title bar:

    Do one of the following:

    • To have the selected occurrence replaced, click Replace.
    • To preserve the selected occurrence and move to the next one, click Skip.
    • To have all the occurrences of the search string in the currently active tab replaced, click Replace All in This File.
    • To preserve the occurrences of the search string in the currently active tab (any) and move to the next file, click Skip to Next File.
    • To have all the detected occurrences replaced, click All Files.
    • To switch to the manual mode, click Preview. The Replace Usage dialog box closes and the focus moves to the Find tool window. Do one of the following:
      • Browse through the list of detected occurrences, select the ones you want to replace and then click Replace Selected.
      • To have all the occurrences changed click Replace All.

Toggling between the Find and Replace

  • To switch from the Find In Path to Replace In Path window, press ⌃⇧R.
  • To switch from the Replace In Path to Find In Path window, press ⌃⇧F.

See Also

Last modified: 26 July 2017