--- title: Syntax editor keyboard shortcuts and actions description: The syntax editor offers keyboard shortcuts and actions to assist in writing code. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/scripts/r\_SyntxEdtrKybrdSrtctsActn.html release: australia product: Scripts classification: scripts topic_type: reference last_updated: "2026-03-12" reading_time_minutes: 3 breadcrumb: [Using the JavaScript syntax editor, JavaScript syntax editor, Scripting, API implementation, API implementation and reference] --- # Syntax editor keyboard shortcuts and actions The syntax editor offers keyboard shortcuts and actions to assist in writing code.
| Keyboard shortcut or action | Description | Example |
|---|---|---|
| Write code | ||
| Scripting assistance Control+Spacebar | Displays a list of valid elements at the insertion point such as: - Class names - Function names - Object names - Variable names Double-click an entry to add it to the script. **Note:** The elements are based on server or client type of script. However, these elements are available based on the UI type you select. For example, spUtil is available for Service Portal client scripts and g\_navigation is available for Desktop scripts. | \[Omitted image "ScriptingAssistanceSuggestions.png"\] Alt text: A line of code for a variable definition with a pop-up window displaying potential scripting elements. |
| Enter a period character after a valid class name. | Displays a list methods for the class. Double-click an entry to add it to the script. | \[Omitted image "ScriptingAssistanceMatchingSuggestionsMethods.png"\] Alt text: A line of code for a variable definition with a pop-up window displaying potential scripting elements. |
| Enter an open parenthesis character after a valid class, function, or method name. | Displays the expected parameters for the class or method. Enter the expected parameters as needed. | \[Omitted image "ScriptingAssistanceParameters.png"\] Alt text: A line of code for a variable defining a method call. There is a pop-up window displaying potential scripting elements. |
| Toggle full screen mode Control+M | Switches between displaying the form with the full screen and displaying it normally. | |
| Format code - Windows: Control+Shift+B - Mac: Command+Shift+B | Formats the selected lines to improve readability. | \[Omitted image "ScriptingAssistanceUnformattedCode.png"\] Alt text: Several lines of unformatted code\[Omitted image "ScriptingAssistanceFormattedCode.png"\] Alt text: Several lines of code formatted for readability |
| Toggle comment - Windows: Control+/ - Mac: Command+/ | Adds or removes the comment characters `//` from the selected lines. | \[Omitted image "ScriptingAssistanceUncommentedCode.png"\] Alt text: A line of code selected with no comment characters\[Omitted image "ScriptingAssistanceCommentedCode.png"\] Alt text: A line of code selected with comment characters added to the front of the line. |
| Insert macro text 1. In the **Script** field, type the macro keyword text. For example `help`. 2. Press Tab. | Inserts macro text at the current position. | \[Omitted image "ScriptingAssistanceMacroTyped.png"\] Alt text: A line of code containing the string help.\[Omitted image "ScriptingAssistanceMacroAdded.png"\] Alt text: The macro text for help added to the script. |
| Search | ||
| Start search - Windows: Control+F - Mac: Command+F | Highlights all occurrences of a search term in the script field and locates the first occurrence. You can create [regular expressions](http://www.regular-expressions.info/reference.html) by enclosing the search terms between slash characters . For example, the search term `/a{3}/` locates the string `aaa` . | \[Omitted image "ScriptingAssistanceSearchTerm.png"\] Alt text: A search field with the term gr.\[Omitted image "ScriptingAssistanceSearchResults.png"\] Alt text: The search results of the search term gr displaying four highlighted items. The first search result is selected. |
| Find next - Windows: Control+G - Mac: Command+G | Locates the next occurrence of the current search term in the script field. Use **Start Searching** to change the current search term. | \[Omitted image "ScriptingAssistanceFindNext.png"\] Alt text: The search results of the search term gr displaying four highlighted items. The second search result is selected. |
| Find previous- Windows: Control+Shift+G - Mac: Command+Shift+G | Locates the previous occurrence of the current search term in the script field. Use **Start Searching** to change the current search term. | \[Omitted image "ScriptingAssistanceSearchResults.png"\] Alt text: The search results of the search term gr displaying four highlighted items. The first search result is selected. |
| Replace - Windows: Control+E - Mac: Command+E | Replaces the next occurrence of a text string in the script field. | \[Omitted image "ScriptingAssistanceReplaceSearchTerm.png"\] Alt text: A replace field with the string gr.\[Omitted image "ScriptingAssistanceReplaceWith.png"\] Alt text: A replace with field with the string gl.\[Omitted image "ScriptingAssistanceReplaceConfirm.png"\] Alt text: A replace confirmation dialog with options for Yes, No, and Stop |
| Replace all - Windows: Control+; - Mac: Command+; | Replaces all occurrences of a text string in the script field. | \[Omitted image "ScriptingAssistanceReplaceAllSearchTerm.png"\] Alt text: A replace field with the search term gr.\[Omitted image "ScriptingAssistanceReplaceAllWith.png"\] Alt text: A replace with field with the string gl. |
| Help | ||
| Help - Windows: Control+H - Mac: Command+H | Displays the list of syntax editor keyboard shortcuts. | \[Omitted image "SyntaxEditorHelp.png"\] Alt text: A pop-up window displaying the keyboard shortcuts for the Syntax Editor. |
| Show description - Windows: Control+J - Mac: Command+J | Displays API documentation for the scripting element at the cursor's current location. | \[Omitted image "ScriptingAssistanceAPIdoc.png"\] Alt text: A line of code selected with a pop-up window displaying API help for the GlideRecord object |
| Show macros 1. In the **Script** field, type `help`. 2. Press Tab. | Displays the list of available syntax editor macros as text within the script field. | \[Omitted image "ScriptingAssistanceMacroTyped.png"\] Alt text: A line of code containing the string help.\[Omitted image "ScriptingAssistanceMacroAdded.png"\] Alt text: The macro text for help added to the script. |