Toad for Oracle
Editor Options
Editor Options can be selected, deselected, and modified on the popup dialog window that is available either from the right-click menu of the editor (on the
SQL Edit or Procedure Edit windows) or from the Edit | Editor Options menu item.
The Editor Options lists categories in the left panel: General Options,
Highlighting, Key Assignments, Auto Replace, and Code Templates. Click any of these items to display its corresponding options in the right panel.
The editor options are stored in the [Language]KEYS.BIN and
[Language]OPTS.TXT files in the Toad\User Files folder, where [Language] is either HTML, INI, JAVA, PLSQL, or TEXT. When a change is made to the Editor
Options, the appropriate OPTS.TXT and KEYS.BIN files are written out. Do not attempt to edit these files with a text editor. Use the Editor Options dialog.
LANGUAGE
HTML
INI
JAVA
PL/SQL
TEXT
EDITOR OPTIONS FILES
HTMLKEYS.BIN HTMLOPTS.TXT
INIKEYS.BIN INIOPTS.TXT
JAVAKEYS.BIN JAVAOPTS.TXT
PLSQLKEYS.BIN PLSQLOPTS.TXT
TEXTKEYS.BIN TEXTOPTS.TXT
The Key Assignments, Auto Replace, and Code Templates items have Load
from File and Save to File buttons. Each of these buttons lets you set up two or more collections of keystrokes, auto replaces, and code templates. This is useful on multi-user machines. For example, one user might prefer to use one set of assigned keys, auto replaces, and code templates, and another user might have a different set for a preference.
84
General Options
General Options contains four categories:
• Printing Options
• Display Options
• Control Options
• General Options
SQL Editor
Click the "+" next to each option to expand its corresponding checklist.
If the checklist is expanded, click the "-" to close the corresponding checklist.
Printing Options
These options are used when you print the editor comments to paper. All are checked by default.
• Wrap lines when printing
• Print line numbers
• Print filename in header
• Print date in header
• Print page numbers
85
Toad for Oracle
Display Options
The display options let you control what is displayed in the editor.
Display line numbers in gutter
Default - Unchecked
When checked, this option will display line numbers in the gutter, which is a vertical region on the left of the editor used to display bookmarks, breakpoints, line numbers, and allow for multiple line selection with the mouse. If unchecked, line numbers will not display. You might want to increase the width of the gutter, in the Gutter Width textbox, to display large line numbers.
Show right margin
Default - Unchecked
When checked, this option displays a light gray vertical line indicating the right margin. When unchecked, no line to indicate the right margin will appear.
In the SQL Editor or Procedure Editor, you can also drag and drop the vertical right margin line left or right to change it.
No word-wrapping occurs at the right margin line. Word-wrapping is discussed later in this chapter in the Show Word-Wrap Column section.
Show gutter
Default - Checked
If checked, the gutter displays. If unchecked, the gutter does not display. If you have chosen to display line numbers, but you have the Show gutter option unchecked, your line numbers which would display in the gutter will not display.
86
SQL Editor
Show word-wrap column
Default - Checked
When checked, this displays the word-wrap column, which is basically a dashed vertical gray line on the right side. You have to enter a value in the word-wrap column value box in order for this to display. The default is 0, which means no word-wrap column will display. So, you need to check the Show word-wrap column check box AND enter a value in the word-wrap column box. For example, if you enter 20, a dashed vertical line displays in column 20, and any lines longer than 20 characters will wrap. The vertical word-wrap line can be dragged and dropped to the left or the right, so you don't have to drill down to the editor options dialog when you want to change the column settings. Word wrapping will not begin until you also check the General options | Word-wrap lines check box.
Block cursor on overwrite
Default - Checked
If this option is checked when you press the insert key to change to overwrite mode, the cursor is displayed as a block because it's in overwrite mode providing a visual reminder that it's in overwrite mode. If the option is unchecked, the cursor remains unchanged when you switch to overwrite mode as opposed to changing to a block.
Show wrapped lines with the |> (arrow) glyph
Default - Checked
If checked, this option displays an arrow in the gutter for wrapped lines.
87
Toad for Oracle
Show control characters
Default - Unchecked
If checked, the control characters (such as paragraph marks, end-of-line characters, spaces, and TABs) will display onscreen in your scripts.
Apply capitalization effects
Default - Unchecked
When checked, this option will apply the capitalization effects that you select from the Highlighting Options section.
Control Options
Allow TCustomSyntaxMemo to be an lDragSource
Default - Checked
When checked, this option lets you select and drag text from an editor to another
Windows application or another Toad window.
Title as Load/Save Filename parameter
Default - Checked
This option is not applicable and not activated.
Track columns in vertical movement
Default - Checked
If this is checked, the editor will attempt to restore the current column position as you key up or down through the lines of text. If the text is wide enough, the current column position is maintained, otherwise it places the cursor at the end of the line.
If this is unchecked, as you key up or down through the lines of text, the cursor column position decrements as the lines of text get shorter.
Respond to dropped files
Default - Checked
If checked, this lets files be dragged and dropped from Explorer to a Toad editor.
88
SQL Editor
Override word-wrap based on line start char
Default - Unchecked
You can specify a character or characters on the Editors Options dialog
Word-wrap override chars textbox that will override word-wrapping for that line only.
For example, if you want to specify that ">" will override word-wrapping for a line, enter it, set word-wrap to column 16, and you'll get:
This is over 16 chars and will word wrap
But when you begin the line with your specified character ">"
>This is over 16 chars and will not word wrap.
General Options
Auto indent
Default - Checked
If you have an indention already set when you type, it automatically indents the following lines.
Tab to next column
Default - Checked
When checked, the <TAB> key moves the cursor to the next column.
Auto select word on double-click
Default - Checked
When checked, if you double-click on a word in the editor it becomes selected.
Insert TABs into text for TAB chars
Default - Checked
Tabs are inserted into the text when the <TAB> key is pressed. Otherwise, an appropriate number of spaces are inserted.
89
Toad for Oracle
Insert mix of TAB/SPACE for optimal fill
Default - Checked
If checked, the editor will fill the required gap with a minimum number of characters composed of TABs and spaces.
Type this:
This line of code starts in column 5
So does this line
If the option is checked you get this:
This line of code starts in column 5
<TAB><SPACE>So does this line
Unchecked, you get this:
This line of code starts in column 5
<SPACE><SPACE><SPACE><SPACE>So does this line
Cursor beyond EOL
Default - Unchecked
When checked, you can type text or move the cursor past the right edge of each line of text.
Word-wrap lines
Default - Unchecked
When checked, text will automatically wrap at the Word-wrap Column margin.
If this option is selected, you cannot type beyond the right margin even if the
Cursor beyond EOL option is checked.
90
SQL Editor
Highlighting
The highlighting options let you select colors, fonts, and capitalization preferences for different items, names, etc. in the current schema. For example,
Reserved word refers to Oracle reserved words. You can change the foreground or background colors for Reserved words, the font, the type size, and even the capitalization. This lets you customize the way your code will appear for whatever is easiest for you to read. A preview pane is provided in the lower part of the window that shows you how the selections you make affect the preview example.
Here, the underline option is checked for datatypes. In the preview screen, the datatype is underlined.
91
Toad for Oracle
The following items can be syntax highlighted independently:
• Reserved Words
• SQL Functions
• Default Packages
• Exceptions
• Comments
• Identifiers
• Strings
• Numbers
• Symbols
• Datatypes
• Tablenames
• View Names
• SYS Views
• SQL Reserved Words
• PL/SQL Reserved Words
• Default Exceptions
• User Procedure Names
You can syntax highlight tablenames in your schema applying different colors and capitalization effects.
92
SQL Editor
Display Item
This lists the display items from which you can choose to modify how they will appear. The last three display items, Selected Text, Left Margin, and Gutter, do not refer to actual code content. They have only certain options enabled.
Selected Text
This is an item in the display items that refers to the colors that will display when you select text by either clicking and dragging the mouse over a section of text, or pressing <SHIFT> and one of the arrow keys to select a portion of text. You can change both the foreground and background colors that will display for the selected text. You can preview your new selected text colors before clicking OK, by selecting text in the preview window and seeing how the new colors affect the selected text. The other selection areas such as font are disabled when you click on the Selected Text item. Only the foreground and background color sections are enabled.
Left Margin
This item only enables the background color choice. If the background color default box is already checked, the dropdown menu will be disabled. In such a case, you must uncheck the default box to enable the dropdown menu. The dropdown menu displays a color palette from which you can choose the color for the left margin vertical bar.
Gutter
This item only enables the background color choice. If the Use Default box for the background color is checked, the dropdown button is disabled. In such a case, you need to uncheck the Use Default box so that the dropdown button is enabled.
Default
The default item lets you change the appearance of your default text if you want to use colors or fonts that are different from the defaults.
The editor supports only one font name for all display items.
93
Toad for Oracle
Capitalization Effect
This dropdown list lets you choose how your item will be capitalized. However, the Apply Capitalization Effects check box in General Options | Display
Options must be checked in order for your capitalization effects to display.
Your choices are:
• Unchanged - No special capitalization will be applied.
• Lowercase - The item will appear in all lowercase letters.
• Uppercase - The item will appear in all uppercase letters.
• Initial Caps - The item will appear with only the first letter of each word in caps.
For object names that contain the underscore character, the first letter after the underscore will also be capitalized, e.g., Table_Name.
Capitalization effects are only applied to your text after you change lines up or down in the editor. E.g., type:
select * from table_name and you will not get capitalization effects until you press <ENTER> or go up or down one or more lines then it is translated to:
SELECT * From Table_Name
Key Assignments
Clicking on the Key Assignments item displays the corresponding Key
Assignments options. The Key command categories listed are:
• Bookmarks
• Caret movement
• Clipboard operations
• Deletion operations
• Miscellaneous
Click the expand button to expand a category's list.
Select an item from the list, and that item's keyboard shortcut will display in the
Activation key sequences window.
94
SQL Editor
Add new sequence
This brings up a series of step boxes that let you add a new sequence by simply typing the sequence in the step boxes.
Edit sequence
This lets you edit the existing sequence through a series of step boxes.
Delete sequence
This deletes whatever sequence is currently highlighted in the Activation key sequences window. If a list of sequences is in the box, you can click a sequence from the list to highlight it and then click the delete sequence button to delete that highlighted sequence.
Auto Replace
Click on Auto Replace to display its corresponding options menu.
Toad already has Auto Replace items including the following.
IF TYPE THIS
(c)
(r)
(tm) ndf teh
REPLACES WITH THIS
©
®
TM
No_Data_Found the
Add definition
This box is enabled after you click in the Current selection window and type a character. The first blank window is where you type the text that you want automatically replaced. The window to the right is where you type the replacement text. Then click the Add definition button to add this to the Auto
Replace list. Remember to Click OK before exiting the window. If you exit the window without clicking OK the new definition will not be added.
Replace definition
This button is enabled after you make a selection from the already defined Auto
Replace list, click in the With window (the window next to the current selection window), and type a character in the With window. After you type the new entry
95
Toad for Oracle that you want to replace the current selection with, click OK and the list will be updated.
Delete definition
This button is enabled after you select a definition from the existing Auto Replace list. Click the Delete definition button to delete the definition from the list. Click
OK and the definition will be deleted.
96
SQL Editor
Auto Replace activation keys
; , : = [ ] \n \t \s
These keys will separate one word from another and trigger the editor to check for and replace one word for another. "\n" is a carriage return, "\t" is a <TAB> character, and "\s" is a space.
For example, if you type "this;that" then "this" will be autoreplaced when the ";" key is pressed.
The autoreplace items are saved and recalled from the Toad\User
Files\[Language]SUB.TXT file, where [Language] could be HTML, INI, JAVA,
PL/SQL, or TEXT. You can directly edit the SUB.TXT file to add, delete, or change the autoreplace substitutions without having to go through the Editor Options dialog.
LANGUAGE
HTML
INI
JAVA
PL/SQL
TEXT
AUTOREPLACE FILE
HTMLSUB.TXT
INISUB.TXT
JAVASUB.TXT
PLSQLSUB.TXT
TEXTSUB.TXT
97
Toad for Oracle
Code Templates
Click the Code Templates item to display its associated options.
Shortcut/Description window
This window lists the code templates that are already defined.
Click on an item from this window and its template will display in the display window that is under the Shortcut/Description window.
Add definition
Click the Add definition button, and a new line with the word new appears in the shortcut templates window. You can then type in the shortcut name. Then tab and type in the description.
98
SQL Editor
Delete definition
The Delete definition button is enabled when you click on a line from the
Shortcut/Description window. To delete a definition, select the
Shortcut/Description you want to delete, click the Delete definition button, and then click OK.
Code template items are saved and recalled from the Toad\User
Files\[Language].DCI file, where [Language] could be HTML, INI, JAVA, PLSQL, or TEXT. You can directly edit the .dci file to add, delete, or change the code templates without having to go through the Editor Options dialog.
LANGUAGE
HTML
INI
JAVA
PL/SQL
TEXT
CODE TEMPLATES FILE
HTML.DCI
INI.DCI
JAVA.DCI
PLSQL.DCI
TEXT.DCI
99