1.10.5 Navigate and Search

CodeBlocks

[Contents] CodeBlocks Manual   [Search] Search

[Table of contents]

1.10.5 Navigate and Search


In CodeBlocks there are different ways of quick navigation between files and functions. Setting bookmarks is a typical procedure. Via the shortcut Ctrl-B a bookmark is set or deleted in the source file. Via Alt-PgUp you can jump to the previous bookmark, and via Alt-PgDn you can jump to the next bookmark.
If you select the workspace or a project in the workspace in the project view you will be able to search for a file in the project. Just select ’Find file’ from the context menu, then type the name of the file and the file will be selected. If you hit return this file will be opened in the editor (see Figure 1.4).

[Figure # 4]
Figure 1.4: Searching for files

In CodeBlocks you can easily navigate between header/source files like:
  1. Set cursor at the location where a header file is include and open this file via the context menu ’open include file’ (see Figure 1.5)
  2. Swap between header and source via the context menu ’Swap header/source’
  3. Select e.g. a define in the editor and choose ’Find declaration’ from the context menu to open the file with its declaration.

[Figure # 5]
Figure 1.5: Opening of a header file

CodeBlocks offeres several ways of searching within a file or directory. The dialogue box for searching is opened via ’Search’ /’Find’ (Ctrl-F) or ’Find in Files’ (Ctrl-Shift-F).
Alt-G and Ctrl-Alt-G are another useful functions. The dialogue which will open on using this shortcut, lets you select files/functions and then jumps to the implementation of the selected function (see Figure 1.6) or opens the selected file in the editor. You may use wildcards like * or ? etc. for an incremental search in the dialog.

[Figure # 6]
Figure 1.6: Search for functions

Note:
With the Ctrl-PgUp shortcut you can jump to the previous function, and via Ctrl-PgDn you can jump to the next function.
In the editor, you can open a new Open Files dialog via Ctrl-Tab and you can switch between the listed entries. If the Ctrl-key is pressed, then a file can be selected in different ways:
  1. If you select an entry with the left mouse button, then the selected file will be opened.
  2. If you press the Tab-key you will switch between the listed entries. Releasing the Crtl-key will open the selected file.
  3. If you move the mouse over the listed entries, then the current selection will be highlighted. Releasing the Crtl-key will open the selected file.
  4. If the mouse pointer is outside the highlighted selection, then you can use the mouse-wheel to switch between the entries. Releasing the Crtl-key will open the selected file.
A common procedure when developing software is to struggle with a set of functions which are implemented in different files. The Browse Tracker plugin will help you solve this problem by showing you the order in which the files were selected. You can then comfortably navigate the function calls (see section 2.8).
The display of line numbers in CodeBlocks can be activated via ’Settings’ /’General Settings’ in the field ’Show line numbers’. The shortcut Ctrl-G or the menu command ’Search’ /’Goto line’ will help you jump to the desired line.
Note:
If you hold the Ctrl key and then select text in the CodeBlocks editor you can perform e.g. a Google search via the context menu.


[Previous] 1.10.4  Configuration Files
[Next] 1.10.6  Symbol view

Created: 2010/25/05 11:52   Updated: 2010/25/05 11:52
Author: HighTec EDV-Systeme GmbH
Copyright © 2010 HighTec EDV-Systeme GmbH