GoLand 2018.3 Help

Finding and replacing text in a file

GoLand lets you find and replace text strings in an active editor.

Search through the current file

  1. From the main menu, choose Edit | Find | Find, or press Ctrl+F. The search pane appears at the top of the active editor.

  2. If necessary, specify the search options.

  3. In the search field, start typing the search string:

    As you type, the first occurrence of the search string after the current cursor position is selected; the other occurrences are highlighted in the editor. In addition, the matching occurrences are marked in the right gutter with stripes.

  4. To search for a multi-line fragment, click multi line mode in the search box or press N/A.

  5. Explore the search results.

Replace in the current file

  1. From the main menu, choose Edit | Find | Replace, or press Ctrl+R. The search and replace pane appears on top of the active editor.

  2. If necessary, specify the search and replace options.

  3. In the search field, start typing the search string. As you type, the matching occurrences are highlighted in the editor, and a Replace pop-up dialog box opens at the first occurrence, suggesting to replace the current occurrence, or all of them, with an empty string.

  4. Start typing the replacing string.

  5. Explore the search results, and, using the buttons of the replace dialog box, replace occurrences as required. See Search and replace options below.

Working with search results

  • To initiate a new search, do one of the following (depending on the current focus):
    • If the editor has the focus, press Ctrl+F.

    • If the search field has the focus, press Ctrl+A

    In both cases, the existing search string will be selected, and you can start typing a new one.

  • To jump between occurrences, do one of the following:
    • Press Shift+F3(jump to previous selection) or F3 (jump to next selection).

    • Use the icons actions previousOccurence svg or icons actions nextOccurence svg buttons in the Search pane.

    • Click the gutter stripes.

  • The search pane shows the number of found occurrences. If no matches are found, the search pane becomes red.

  • Use the recent search history: with the search pane already open, click find1 to show the list of recent entries.

  • To cancel the operation and close the pane, press Escape.

  • Use multiple selection (multiselection). For example, if a certain string has been highlighted as a search result, it is possible to add an occurrence of this string to multiple selection by clicking icons actions AddMulticaret (Alt+J), delete an occurrence from multiple selection using remove selection icon (Shift+Alt+J), or add all found occurrences to multiple selection using select all occurrences icon (Ctrl+Shift+Alt+J).

Search and replace options

Item

Description

Search/Replace

find1

Click this button to show the history of the recent entries.

Search, replace

icons actions clear

Click this button to clear the search field.

Search, replace

icons actions previousOccurence svg icons actions nextOccurence svg

Click these buttons to navigate through the occurrences of the search string.

Search, replace

icons actions AddMulticaret

Click this button to add the next found occurrence to a multiple selection.

Search

remove selection icon

Click this button to remove the found occurrence from a multiple selection.

Search

select all occurrences icon

Click this button to create a selection that contains all the found occurrences.

Search

Find all

Click this button to show search results in the Find tool window.

Search, replace

Match Case

If this checkbox is selected, GoLand will distinguish between upper and lowercase letters while searching.

Search, replace

Regex

If this checkbox is selected, the search string will be perceived as a regular expression, and the replacement preview is shown in a tooltip. While in the Find or Replace field, press Alt+X (previously known as Alt+G) to quickly select or clear the selected Regex checkbox.

Search, replace

Words

If this checkbox is selected, GoLand will search for whole words only, that is, for character strings separated with spaces, tabs, punctuation, or special characters.
This checkbox is disabled if the Regular expressions checkbox is selected.

Search, replace

Preserve Case

If this checkbox is selected, GoLand retains the case of the first letter and the case of the initial string in general. For example, MyTest will be replaced with Yourtest if you specify yourtest as the replacement.
This checkbox is disabled if Regular expressions checkbox is selected.

Replace

In Selection

If this checkbox is selected, search and replacement will be confined to the selected text only.

Replace

Replace

Click this button to replace the current occurrence and proceed to the next one.

Replace

Replace all

Click this button the replace all found occurrences in the current file, or in the selection.

Replace

Exclude/Include

Click the Exclude button to skip the current occurrence and exclude it from the Replace all operation. The button for this occurrence changes to Include.

Replace

show filter popup

Click this button to invoke the list of additional options. Checking the corresponding option confines the search to the specified scope, while the other occurrences are ignored.

Search, replace

Last modified: 6 February 2019

See Also