Navigation

There are two types of navigation in SlickEdit® Core: Code Navigation, which provides in-depth symbol navigation and structure matching, and Cursor Navigation, which pertains to more simple movements within text and files.

Code Navigation

Some of the most powerful features in SlickEdit Core are its code navigation methods, particularly Symbol Navigation. These features allow you to navigate your code the way you think about it, rather than just as a set of files. If you aren't using SlickEdit Core's code navigation features, you aren't getting the most out of the editor.

Symbol Navigation

Symbol Navigation allows you to jump from a symbol to its definition or to a reference with a single keystroke. A pushed bookmark is set, allowing you to return to the symbol with another keystroke. You can chain a series of these navigation operations together, creating a stack of locations. Then pop your way back to the starting location.

To navigate between symbols use the following operations:

  • Go to Definition - To quickly move the cursor from a symbol to its definition, pushing a bookmark in the process, press Ctrl+Dot. Alternatively, click Navigate → Go to Definition or use the push_tag command.

  • Go to Reference - To create a list of references and optionally jump to the first one, pushing a bookmark in the process, press Ctrl+/. Alternatively, click Navigate → Go to Reference or use the push_ref command.

  • Pop Bookmark - To pop the bookmark and return to the previous location, press Ctrl+Comma. Alternatively, click Search → Pop Bookmark or use the pop_bookmark command. See Pushed Bookmarks for more information about working with bookmarks.

When you first call these operations, if a tag file does not exist for the current file, it will be built (see Building Tag Files).

Tip

Procs and prototypes - In C and C++, navigating from a symbol to its definition will prompt you to select whether you want to go to the prototype or the function. You can tell SlickEdit® Core to always go to one or the other by setting one of the options Prioritize navigation to symbol definition (proc) or Prioritize navigation to symbol declaration (proto). To set these options, from the main menu, click Window → SlickEdit Preferences → Languages, expand your language category and language, then select Context Tagging®. When the cursor is in the prototype, pressing Ctrl+Dot will navigate to the function and vice versa. If you do not set one of these options, you will be prompted with the Select Symbol Dialog the first time you navigate from a symbol to its definition.

Automatically Closing Visited Files

Some features and operations in SlickEdit® automatically open files for "visiting", such as Go to Definition and Pop Bookmark (see Symbol Navigation). A file is considered visited if it is opened as a result of a symbol navigation or search operation, not modified, and subsequently navigated away from. An option is available to automatically close these visited files. To access the Automatically close visited files option, from the main menu, click Window → SlickEdit Preferences, then expand Editing and select Bookmarks. You can enable the option or you can choose to be prompted to close each time you navigate away from a visited file.

Navigating Between Multiple Instances

If more than one instance of the definition or reference is found, the Select Symbol Dialog is displayed, from which you can select the instance to navigate to. To go to the next occurrence, press Ctrl+G (Edit → Find Next or find_next command). To go to the previous occurrence, press Ctrl+Shift+G (Edit → Find Previous or find_prev command).

Alternatively, press Ctrl+Down (next_tag command) or Ctrl+Up (prev_tag command) to place the cursor on the next or previous symbol definition.

Using the Find Symbol View

The Find Symbol View (Search → Find Symbol or gui_push_tag command) is used to locate symbols (tags) which are declared or defined in your code. It allows you to search for symbols by name using either a regular expression, substring, or fast prefix match. See Find Symbol View for descriptions of the options that are available.

More Symbol Navigation Methods

There are several other methods for navigating to symbols:

  • The Symbols View shows the symbols for all tag files. Right-click in the view and select Find Tag to search for a specific symbol. You can also use the cb_find command to find the symbol under the cursor and display it in the Symbols view.

  • At the SlickEdit® Core command line, use the f command and completion keys (Space and ?) to enter a tag name. For example, if tagging the C run-time library, type f str? on the command line for a list of tag names starting with "str" (such as strcpy, strcmp, etc.).

  • To navigate to a Slick-C® symbol, you can use the fp command (a shortcut for find_proc). If editing a Slick-C macro, then enter the push_tag command (Ctrl+Dot) to find the symbol at the cursor. The push_tag command actually calls the find_proc command with the symbol name at the cursor to perform the task.

Navigating Between Words

To navigate between words, use the next_word (Ctrl+Right) and prev_word (Ctrl+Left) commands. The next_word command moves the cursor to the beginning of the next word. The prev_word command moves the cursor to the beginning of the previous word.

A word is determined by the Word chars value you set for the programming language (Window → SlickEdit Preferences → Languages → [Language Category] → [Language] → General). For C, C++, and Java this is set to A-Za-z0-9_$ by default. The next_word command, for example, will skip over any contiguous characters from that set.

You can specify whether the cursor moves to the beginning or the end of the next/previous word. Click Window → SlickEdit Preferences → Editing → General, then set the Next word style to Begin or End. This affects both next_word and prev_word commands.

If you have enabled subword navigation (see Subword Navigation), the word navigation commands will behave like their subword navigation counterparts. You can still perform regular word navigation using the "full" word commands: next_full_word, prev_full_word, select_full_word, copy_full_word, cut_full_word, delete_full_word, and delete_prev_full_word.

Subword Navigation

Subword navigation provides the capability to navigate within a word, stopping at capitalized letters or letters following common dividers like underscore or dash. If the target word does not contain any subwords, then the subword commands behave like their word navigation counterparts.

You can configure SlickEdit to use subword navigation instead of the regular word navigation by selecting Window → SlickEdit Preferences → Editing → Cursor Movement and setting Subword Navigation to True. When this option is on, you can still perform "full" word navigation using the _full_word commands. See Navigating Between Words for more information.

The following subword navigation commands are provided. For convenience, you can bind them to a key sequence using Window → SlickEdit Preferences → Key Bindings You can also use the Key Bindings screen to search for subword commands by entering "subword" in the Search by command field. Then you can view further documentation on each command.

  • next_subword - Moves the cursor to the next subword.

  • prev_subword - Moves the cursor to the previous subword.

  • select_subword - Selects the next subword.

  • copy_subword - Copies the next subword to the clipboard.

  • cut_subword - Cuts the next subword, putting it in the clipboard.

  • delete_subword - Deletes the next subword without putting it in the clipboard.

  • delete_prev_subword - Deletes the previous subword without putting it in the clipboard.

Begin/End Structure Matching

Begin/End Structure Matching moves the cursor from the beginning of a code structure to the end, or vice versa. This works for languages using curly braces "{ }", "begin" and "end", or any other defined begin/end pairs.

To place the cursor on the opposite end of the structure when the cursor is on a begin or end keyword pair, press Ctrl+] (find_matching_paren command or from the menu click Navigate → Go to Matching Parenthesis). The find_matching_paren command supports matching parenthesis pairs { },[ ] and ( ).

Tip

For Python, SlickEdit® Core supports the matching of the colon (:) token and the end of context. See Begin/End Structure Matching for Python for more information.

Viewing and Defining Begin/End Pairs

Use the language-specific General options screen to view or define the begin/end pairs for any language. To access this dialog, from the main menu, click Window → SlickEdit Preferences → Languages, expand your language category and language, then select General.

In the Begin/end pairs text field, specify the pairs in a format similar to a regular expression.

Note

This text box is unavailable (dimmed) for languages that have special begin/end matching built-in.

The examples below illustrate the syntax for defining the begin/end pairs. The begin and end pair matching option is case-sensitive by default. Append ";I" (a semicolon followed by an upper-case i) to ignore case.

Example 1
(begin),(case)|(end);I

The above begin/end pairs are for the Pascal language. The Pascal language requires a more sophisticated expression. This expression indicates the keywords begin or case start a block and the keyword end terminates the block. The , (comma) is used to specify multiple begins or multiple ends. The | operator is used to separate begins from ends.

Example 2
(#ifdef),(#ifndef),(#if)|(#endif)

The above pairs are for the C language. The C language has the added complication that #if is a sub-string of #ifdef. Due to the implementation of begin/end matching, #ifdef must appear before #if.

More settings for begin/end pairs can be found on the [Language] Formatting Options screen (Window → SlickEdit Preferences → Languages → [Language Category] → [Language]). See Language-Specific Formatting Options for more information.

Setting the Paren Match Style

As you type a closing parenthesis, highlight and matching options are available. To specify these options, from the main menu, click Window → SlickEdit Preferences, expand Editing, then click General and set the value of the Parenthesis matching style option.

The Highlight style option temporarily block-selects the text within the parenthesis pair. The Cursor to Begin Pair style option temporarily places the cursor on the matching begin parenthesis.

Select Highlight matching blocks to automatically highlight the corresponding parenthesis, brace, bracket, or begin/end word pairs under the cursor. To customize the highlighting color, from the main menu, click Window → SlickEdit Preferences → Appearance → Colors, and select the Block Matching screen element. To adjust the delay in milliseconds before the highlighting is updated, go to Macro → Set Macro Variable and modify the variable def_match_paren_idle. See Setting Colors for Screen Elements and Setting/Changing Configuration Variables for more information.

Navigating in Statements and Tags

The following navigation commands are available for languages that support statement tagging:

  • next_tag / prev_tag - Places the cursor on the next/previous tag definition, skipping any tags filtered out by the Defs view.

  • next_proc / prev_proc - Places the cursor on the next/previous function heading.

  • find_tag - Displays a list of tags in the Select Symbol Dialog, allowing you to pick the tag to which you want to navigate.

  • goto_tag - Prompts for a procedure tag name and places the cursor on the definition of the procedure name specified. This command is available in GNU Emacs emulation mode only.

  • end_tag - Places the cursor at the end of the current symbol definition. This is useful if you are in the middle of a large function or class definition and you want to jump to the end of it. In a class definition in C++, the end is where inline function definitions are usually stored.

  • end_proc - Moves the cursor to the end of the current procedure.

  • next_statement / prev_statement - Moves the cursor to the beginning of the next/previous statement.

  • begin_statement / end_statement - Places the cursor at the beginning/end of the current statement.

  • next_sibling / prev_sibling - Moves the cursor to the beginning of the next/previous sibling. These are similar to the next_statement/prev_statement commands except they stay at one level of nesting.

  • goto_parent - Moves the cursor to the beginning of the enclosing statement or symbol scope relative to the current cursor position.

  • begin_statement_block / end_statement_block - Moves the cursor to the beginning/end of the current statement block.

Navigating with S-expressions

S-expressions are symbolic expressions. They can be a single symbol or a set of symbols contained in a structure. First popularized in Lisp and Emacs, SlickEdit Core provides several navigation commands using S-expressions.

These commands are particularly useful in XML and HTML, where the structures created by begin and end tags are treated as S-expressions. These commands allow you to skip over or drill down into text bounded by tags.

The following commands are available, with their default keybindings in CUA emulation:

  • prev_sexp - Moves to the previous S-expression (Ctrl +Alt +Left).

  • next_sexp - Moves to the next S-expression (Ctrl +Alt +Right).

  • backward_up_sexp - Navigates to the start of the immediately enclosing block (Ctrl +Alt +Up).

  • forward_down_sexp - Drills down into the next block (Ctrl +Alt +Down).

  • select_prev_sexp - Extends a character selection from the cursor to the start of the previous S-expression (Ctrl +Alt +Shift +Left).

  • select_next_sexp - Extends a character selection from the cursor to the start of the next S-expression (Ctrl +Alt +Shift +Right).

  • cut_prev_sexp - Deletes the S-expression to the left of the cursor and copies it to the clipboard (Ctrl +Alt +Backspace).

Cursor Navigation

These cursor navigation methods pertain to simple cursor movement within files. We recommend creating key bindings for commands that you use frequently (if a key binding doesn't already exist by default).

Navigating in Pages and Files

The following commands control cursor navigation in pages and files:

  • cursor_right (Right Arrow) - Moves the cursor one column to the right. If the cursor is at the end of the line, this command will move the cursor to the next line depending on the value for Cursor right/left wraps to next/previous line (Window → SlickEdit Preferences → Editing → Cursor Movement).

  • cursor_left (Left Arrow) - Moves the cursor one column to the left. If the cursor is at the beginning of the line, this command will move the cursor to the previous line depending on the value for Cursor right/left wraps to next/previous line (Window → SlickEdit Preferences → Editing → Cursor Movement).

  • cursor_up (Up Arrow) - Moves the cursor to the previous line. If the cursor is located in a column that is beyond the last column of the previous line, the cursor position is controlled by Cursor up/down places cursor in virtual space (Window → SlickEdit Preferences → Editing → Cursor Movement).

  • cursor_down (Down Arrow) - Moves the cursor to the next line. If the cursor is located in a column that is beyond the last column of the next line, the cursor position is controlled by Cursor up/down places cursor in virtual space (Window → SlickEdit Preferences → Editing → Cursor Movement).

  • page_up / page_down (PgUp/PgDn) - Moves the cursor to the previous/next page of text.

  • page_left / page_right - Changes the left edge scroll position by half the window width to the left/right. The cursor is moved half the window width to the left/right as well.

  • top_of_window / bottom_of_window (Ctrl+PgUp/Ctrl+PgDn) - Places the cursor at the top/bottom of the current editor window.

  • top_of_buffer / bottom_of_buffer (Ctrl+Home/Ctrl+End) - The top_of_buffer command places the cursor at the first line and first column of the current buffer. The bottom_of_buffer command places the cursor at the end of the last line of the current buffer. If the option Preserve column on top/bottom is enabled (Window → SlickEdit Preferences → Editing → General), the cursor is placed at the first line/last line of the buffer and the column position is unchanged.

Tip

There is an option to make top_of_buffer/bottom_of_buffer push a bookmark, providing quick navigation between the top/bottom of the buffer and the previous location. See Pushed Bookmark Options for more information.

  • top_left_of_window / bottom_left_of_window - Places the cursor at the top left/bottom right of the current editor window.

Navigating to a Specific Line

To view and place the cursor on a specific line number, from the main menu, click Navigate → Go to Line. Enter the line number and click OK. Alternatively, you can use the goto_line command in the syntax goto_line linenumber.

Navigating to an Offset

To seek to a byte offset in the current buffer, from the main menu click Navigate → Go to Offset, or use the gui_seek command. This function is the same as the C lseek function. However, if you have opened the file with tab expansion, the seek position on disk may be different.

When the Seek dialog appears, enter the position to seek for. You may specify a C syntax expression. In addition, you may prefix the expression with a plus or minus sign (+ or -) to specify a relative seek position.

Some examples are:

  • 0x10+10 - Seek to offset 26

  • +8+4 - Seek to current offset + 12

  • -8+4 - Seek to current offset - 12

Select the Decimal option to enter the seek position in decimal number format. Select the Hex option to enter the seek position in hexadecimal number format. You can type an "x" as the first character in the Position to seek for text box and this option will automatically be selected.

Navigating to URLs

SlickEdit® Core treats URLs in editor windows as hyperlinks, making them easy to identify and open in a Web browser from within your code. By default, a string is interpreted as a URL if it begins with one of the following URI schemes, or, URL types (including the colon and slashes):

  • file://

  • ftp://

  • http://

  • https://

URLs are underlined. You can navigate to a link by hovering over it with the mouse and using Ctrl+Click (or Command+Click on the Mac). The link opens in a new Web browser window, or the current browser window if one is already open. The file:// URI scheme is handled differently (see Handling File URLS below).

When using the mouse to hover over an http:// link, click the green arrow to open the source code in SlickEdit Core.

The URI Schemes node of the Options dialog lets you specify the recognized URI schemes, and makes it easy to extend this feature. For example, you may want to add a mailto URI scheme so that e-mail URLs are recognized. To access these options, from the main menu, click Window → SlickEdit Preferences, expand Network & Internet Options, then select URI Schemes. See URI Scheme Options for more information.

Handling File URLS

Files can be designated using the file:// URI scheme. Depending on the file type, a file can be opened in a browser, passed to an application for opening, or executed. How the file is handled depends on the operating system and the settings in Window → SlickEdit Preferences → Languages → File Extension Manager.

The File Extension Manager provides two settings to control this behavior:

  • Open Application - Specifies an application to open files with the selected extension.

  • Use file association - Overrides the application specified in Open Application and uses the operating system to determine what application to use. This is only applicable to Microsoft Windows operating systems.

If an application is specified in the Open Application field, the file will be passed to that application for opening.

If Use file association is checked, the operating system is used to determine what application to use. This is only applicable on Windows.

If both fields are left blank, SlickEdit® Core will use the operating system to determine what application to use. This is the same as if you checked Use file association and is only applicable on Windows.

Runnable Files

A file:// URI scheme can be used to specify a runnable file, like a batch file, script file, or executable. On Windows, the operating system is used to automatically identify runnable files and run them, unless you have specified a value for Open Application.

On Linux, UNIX, or Mac you have to specify how to run a runnable file by specifying an application or system command in the Open Application field. For example, on Linux you can run a Perl file by specifying the path to the Perl interpreter in Open Application. You also need to include the escape sequence denoting the file name, for example, /usr/bin/perl %f. The %f inserts the full path for the file portion of the URL. If you want to run a binary file you would just specify put %f in the Open Application field.

Other URI Schemes

You can add additional URI schemes to be treated as links (see URI Scheme Options). On Windows, the operating system will determine how to handle the URL. For example, using ms-help:// will open the associated link in MSDN Help. On all other platforms, the link will be sent to the browser.