defaultCommands
defaultCommands(
selfClosePairs
,selfCloseRegex
):BasicExtension
Defined in: extensions/commands.ts:54
Extension that will add automatic indentation, closing of brackets, quotes and tags along with the following commands:
- Alt+ArrowUp/Down: Move line up/down
- Ctrl+ArrowUp/Down (Not on MacOS): Scroll up/down 1 line
- Shift+Alt+ArrowUp/Down: Copy line up/down
- Ctrl+Enter (Cmd+Enter on MacOS): Insert blank line
- Ctrl+[ (Cmd+[ on MacOS): Outdent line
- Ctrl+] (Cmd+] on MacOS): Indent line
- Shift+Ctrl+K (Shift+Cmd + K on MacOS): Delete line
- Ctrl+/ (Cmd+/ on MacOS): Toggle comment
- Shift+Alt+A: Toggle block comment
- Ctrl+M (Ctrl+Shift+M on MacOS): Toggle Tab capturing
The shortcuts for the commands are not easily customizable. If you want to customize them, you can copy the https://github.com/FIameCaster/prism-code-editor/blob/main/package/src/extensions/commands.ts|source and change the conditions.
Parameters
Section titled “Parameters”selfClosePairs
Section titled “selfClosePairs”string
[] = ...
Pairs of self-closing brackets and quotes.
Must be an array of strings with 2 characters each.
Defaults to ['""', "''", '``', '()', '[]', '{}']
.
selfCloseRegex
Section titled “selfCloseRegex”RegExp
= ...
Regex controlling whether or not a bracket/quote should
automatically close based on the character before and after the cursor.
Defaults to /([^$\w'"`]["'`]|.[[({])[.,:;\])}>\s]|.[[({]`/s
.