{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":673,"path":"api-reference/scripts/r_SyntxEdtrKybrdSrtctsActn.md","title":"Syntax editor keyboard shortcuts and actions","bundle":null,"doc_type":null,"release":"australia","body":"\n# Syntax editor keyboard shortcuts and actions\n\nThe syntax editor offers keyboard shortcuts and actions to assist in writing code.\n\n<table id=\"table_wmy_bpl_ss\"><thead><tr><th>\n\nKeyboard shortcut or action\n\n</th><th>\n\nDescription\n\n</th><th>\n\nExample\n\n</th></tr></thead><tbody><tr><td class=\"sub-head\" colspan=\"3\">\n\nWrite code\n\n</td></tr><tr><td>\n\nScripting assistance\n\n Control+Spacebar\n\n</td><td>\n\nDisplays a list of valid elements at the insertion point such as:\n\n-   Class names\n-   Function names\n-   Object names\n-   Variable names\n\n Double-click an entry to add it to the script.\n\n**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.\n\n</td><td>\n\n\\[Omitted image \"ScriptingAssistanceSuggestions.png\"\\] Alt text: A line of code for a variable definition with a pop-up window displaying potential scripting elements.\n\n</td></tr><tr><td>\n\nEnter a period character after a valid class name.\n\n</td><td>\n\nDisplays a list methods for the class.\n\n Double-click an entry to add it to the script.\n\n</td><td>\n\n\\[Omitted image \"ScriptingAssistanceMatchingSuggestionsMethods.png\"\\] Alt text: A line of code for a variable definition with a pop-up window displaying potential scripting elements.\n\n</td></tr><tr><td>\n\nEnter an open parenthesis character after a valid class, function, or method name.\n\n</td><td>\n\nDisplays the expected parameters for the class or method.\n\n Enter the expected parameters as needed.\n\n</td><td>\n\n\\[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.\n\n</td></tr><tr><td>\n\nToggle full screen mode\n\n Control+M\n\n</td><td>\n\nSwitches between displaying the form with the full screen and displaying it normally.\n\n</td><td>\n\n \n\n</td></tr><tr><td>\n\nFormat code\n\n-   Windows: Control+Shift+B\n-   Mac: Command+Shift+B\n\n</td><td>\n\nFormats the selected lines to improve readability.\n\n</td><td>\n\n\\[Omitted image \"ScriptingAssistanceUnformattedCode.png\"\\] Alt text: Several lines of unformatted code\\[Omitted image \"ScriptingAssistanceFormattedCode.png\"\\] Alt text: Several lines of code formatted for readability\n\n</td></tr><tr><td>\n\nToggle comment\n\n-   Windows: Control+/\n-   Mac: Command+/\n\n</td><td>\n\nAdds or removes the comment characters `//` from the selected lines.\n\n</td><td>\n\n\\[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.\n\n</td></tr><tr><td>\n\nInsert macro text\n\n1.  In the **Script** field, type the macro keyword text. For example `help`.\n2.  Press Tab.\n\n</td><td>\n\nInserts macro text at the current position.\n\n</td><td>\n\n\\[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.\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"3\">\n\nSearch\n\n</td></tr><tr><td>\n\nStart search\n\n-   Windows: Control+F\n-   Mac: Command+F\n\n</td><td>\n\nHighlights all occurrences of a search term in the script field and locates the first occurrence.\n\n 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` .\n\n</td><td>\n\n\\[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.\n\n</td></tr><tr><td>\n\nFind next\n\n-   Windows: Control+G\n-   Mac: Command+G\n\n</td><td>\n\nLocates the next occurrence of the current search term in the script field. Use **Start Searching** to change the current search term.\n\n</td><td>\n\n\\[Omitted image \"ScriptingAssistanceFindNext.png\"\\] Alt text: The search results of the search term gr displaying four highlighted items. The second search result is selected.\n\n</td></tr><tr><td>\n\nFind previous-   Windows: Control+Shift+G\n-   Mac: Command+Shift+G\n\n</td><td>\n\nLocates the previous occurrence of the current search term in the script field. Use **Start Searching** to change the current search term.\n\n</td><td>\n\n\\[Omitted image \"ScriptingAssistanceSearchResults.png\"\\] Alt text: The search results of the search term gr displaying four highlighted items. The first search result is selected.\n\n</td></tr><tr><td>\n\nReplace\n\n-   Windows: Control+E\n-   Mac: Command+E\n\n</td><td>\n\nReplaces the next occurrence of a text string in the script field.\n\n</td><td>\n\n\\[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\n\n</td></tr><tr><td>\n\nReplace all\n\n-   Windows: Control+;\n-   Mac: Command+;\n\n</td><td>\n\nReplaces all occurrences of a text string in the script field.\n\n</td><td>\n\n\\[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.\n\n</td></tr><tr><td class=\"sub-head\" colspan=\"3\">\n\nHelp\n\n</td></tr><tr><td>\n\nHelp\n\n-   Windows: Control+H\n-   Mac: Command+H\n\n</td><td>\n\nDisplays the list of syntax editor keyboard shortcuts.\n\n</td><td>\n\n\\[Omitted image \"SyntaxEditorHelp.png\"\\] Alt text: A pop-up window displaying the keyboard shortcuts for the Syntax Editor.\n\n</td></tr><tr><td>\n\nShow description\n\n-   Windows: Control+J\n-   Mac: Command+J\n\n</td><td>\n\nDisplays API documentation for the scripting element at the cursor's current location.\n\n</td><td>\n\n\\[Omitted image \"ScriptingAssistanceAPIdoc.png\"\\] Alt text: A line of code selected with a pop-up window displaying API help for the GlideRecord object\n\n</td></tr><tr><td>\n\nShow macros\n\n1.  In the **Script** field, type `help`.\n2.  Press Tab.\n\n</td><td>\n\nDisplays the list of available syntax editor macros as text within the script field.\n\n</td><td>\n\n\\[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.\n\n</td></tr></tbody>\n</table>**Parent Topic:**[Using the JavaScript syntax editor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/r_EdtJvaScptWSyntxEdtr.md)\n\n"}}