[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
GPS provides extensive search capabilities among its different elements. For instance, it is possible to search in the currently edited source file, or in all the source files belonging to the project, even those that are not currently open. It is also possible to search in the project explorer (on the left side of the main GPS window), or the help modules,...
All these search contexts are grouped into a single graphical window,
that you can open either through the menu Navigate->Find/Replace...
, or
the shortcut Ctrl-F.
Selecting either of these two options will pop up a dialog on the screen, similar to the following:
On this screen shot, you can see three entry fields:
Search for
Options
button and selecting the
appropriate check box, or by opening the combo box (click on the arrow
on the right of the entry field).
In this combo box, a number of predefined patterns are provided. The top two ones are empty patterns, that automatically set up the appropriate fixed strings/regular expression mode. The other regular expressions are language-specific, and will match patterns like Ada type definition, C++ method declaration,...
Replace with
Look in
Clicking on the arrow on the right will display the list of all possible contexts. This list includes:
Project Explorer
Projects, Directories, Files, Entities
. The search in entities
may take a long time, search each file is parsed during the search.
Open Files
Files...
section below.
Files...
*.ad?
for all files ending with .ad and any
trailing character. The directory specified where the search starts, and
the Recursive search button whether sub directories will be searched
as well.
The Scope entry is used to restrict the search to a set of language constructs, e.g. to avoid matching on comments when you are only interested in actual code, or to only search strings and comments, and ignore the code.
Files From Project
Files...
section above.
Current File
Files...
section above.
Project Browser
Help
The second part of the window is a row of buttons, to start the search (or continue to the next occurrence), to stop the current search when it is taking too long, or to display the options.
There are four check boxes in this options box.
"Search All Occurrences"
Next
button (or the equivalent shortcut
Ctrl-N) to go to the next occurrence.
However, if you enable this check box, the search widget will start
searching for all occurrences right away, and put the results in a new
window called Locations
(initially found in the bottom dock of
the GPS window). You can interrupt the search at any time by pressing
the Stop
button: this will stop when the next occurrence is found.
This button is reset to its default value whenever you modify the searched pattern or the replacement text.
"Case Sensitive"
"Whole Word Only"
"Regular Expression"
Search for:
field.
The grammar followed by the regular expressions is similar to the Perl and
Python regular expressions grammar, and is documented in the GNAT run time file
`g-regpat.ads'. To open it from GPS, you can use the open from project
dialog (File->Open From Project...
) and type g-regpat.ads. See
Open From Project for more information on this dialog.
As most GPS components, the search window is under control of the multiple document interface, and can thus be integrated into the main GPS window instead of being an external window.
To force this behavior, open the menu Window
, select
Search
in the list at the bottom of the menu, and then select
either Floating
or Docked
.
If you save the desktop (File->Save More->Desktop
, GPS will
automatically reopen the search dialog in its new place when it is
started next time.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |