Expand description
The Fast Text plugin system.
Plugins are small Rhai scripts that register named
commands and keybindings. They describe edits as EditorActions rather
than touching the editor directly, so they are safe, sandboxed, and easy to
apply from any frontend.
Example plugin:
// Wrap the selection in quotes.
fn quote_selection() {
insert("\"" + selected_text + "\"");
}
command_with_desc("Wrap in quotes", "Surround the selection with \"", "quote_selection");
bind("ctrl+shift+q", "Wrap in quotes");Globals available to scripts: cursor, selection_start, selection_end,
has_selection, selected_text, line, col, doc_len, line_count,
file_name, language.
Structs§
- Command
Info - Metadata about a registered command.
- Editor
Context - A snapshot of the editor, exposed to scripts as global constants.
- KeySpec
- A key plus its modifier state, as written in a plugin, e.g.
ctrl+shift+k. - Plugin
Host - Loads Rhai plugins and runs their commands against the editor.
Enums§
- Cursor
Style - The shape of the terminal cursor.
- Editor
Action - A movement or edit a plugin wants performed.
- KeyName
- A key, independent of any particular terminal backend.