Skip to content

Commands

Matthew Daly edited this page Jul 8, 2022 · 10 revisions

Maple features an internal command line to perform tasks like saving, loading, and more advanced document editing/navigation.

Using the command line

The command line can be toggled with esc, and appears in the footer. Hit Enter to execute a command.

The command line stores all commands in the history, which can be navigated with Up and Down.

Some commands may result in an output message. Output is displayed in the footer and is colored as either Info, Error, or Success. By default, pressing esc while there is output will clear the output and display the footer, rather than immediately toggling to the command input.

Commands

Execute commands from within maple by toggling to command input with the esc key.

Basic Commands

Command Parameters Description
help [command] Display help text about the given command. Use help all to list all, or help wiki to open this wiki.
close Close maple without saving.
save [filename] [encoding] Save the current file. [filename] can be included optionally to "save-as". [encoding] can be --utf8 or --ascii, optionally.
load [filename] Load the given file into the editor (changes to the current file will not be saved!). If no file name is specified, the current file will be reloaded. Can be used with Nicknames.
new [filename] Create a new file at the given path (changes to the current file will not be saved!).
undo Undo the most recent change.
redo Redo the most recent change.
alias [command] View all aliases for a given command.
shortcut [key] View the command bound to a given shortcut key. shortcut will also mention if the command executes instantly or if prefills.

Navigation

Command Parameters Description
top Move the cursor to the first line of the document.
bot Move the cursor to the last line of the document.
goto [line number] Move the cursor to the given line.
find [query] [switches] Search the document for the given query. The query is all of the text following the command name and preceding the first switch (trailing whitespace is trimmed). Find behavior can be modified with the following switches, which can be combined. If no query is provided, find will continue with the previous search.
--first / -f Start at the first occurrence.
--last / -l Start at the last occurrence.
--up / -u Move upwards through the occurrences.
--count / -ct Return the number of occurrences without moving the cursor.
--case / -c Match with case sensitivity.
--here / -h Search for the text at the cursor position. Query is set to the nearest token value as determined by the current syntax rules.
count [switches] Count a given statistic about the current document. Switches can be combined to print multiple statistics at once.
--lines / -l The number of lines (file lines, not lines of code).
--chars / -c The number of characters.

Editing

Command Parameters Description
selectin Mark the beginning of a selection.
selectout Mark the end of a selection.
selectline Select the current line.
selectall Select the entire document.
deselect Deselect the current selection.
copy Copy the current selection or line to the internal clipboard.
paste Paste the contents of the internal clipboard.
cut Cut the current selection or line.
deindent Deindent the current line or selection.
readonly Toggle read-only mode.

Advanced Commands

Command Parameters Description
cls Manually clear the previous command output.
redraw Force the editor to fully redraw, which usually fixes rendering errors. After resizing the terminal window, call redraw to fix the visual glitches.
syntax [extension] Load the appropriate syntax rules for the given extension, re-tokenize, and redraw the current document. If no extension is provided, syntax will print the path of the current syntax file.
url If the cursor is currently hovering on a URL, open it in the browser. URLs are determined by the current syntax highlighting rules.

Aliases

Maple supports custom aliases for commands to make them easier to remember and faster to type. Each alias corresponds to a single maple command, but a single command can have multiple aliases. Aliases are stored in properties/properties.xml, which comes with a few preset aliases by default.

The alias command is a good way to keep track of all the aliases available.

Shortcuts

Maple supports custom keyboard shortcuts which automatically enter commands. Shortcuts can also be configured to automatically execute their commands. Shortcuts are stored in properties/properties.xml and includes some common shortcuts like Ctrl + S for save. Note that this shortcut executes immediately because in the XML file it is marked with execute="True", while a shortcut like Ctrl + F simply fills the command input with find , allowing the user to enter their query more quickly.

The shortcut command is a good way to keep track of which keys are bound to shortcuts.

NOTE: Shortcut keys are always assumed to be used with the Ctrl key. Modifiers Shift and Alt are unsupported currently. By default, Windows Terminal binds Ctrl + V to paste, which will interfere with maple's internal paste command.

Clone this wiki locally