Skip to main content

Crate fast_text_plugin

Crate fast_text_plugin 

Source
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§

CommandInfo
Metadata about a registered command.
EditorContext
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.
PluginHost
Loads Rhai plugins and runs their commands against the editor.

Enums§

CursorStyle
The shape of the terminal cursor.
EditorAction
A movement or edit a plugin wants performed.
KeyName
A key, independent of any particular terminal backend.