ZotInstruct
A Sublime Text plugin that sends the selected code together with an instruction to the active zot session
Details
Installs
- Total 0
- Win 0
- Mac 0
- Linux 0
| Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Zot Instruct
A Sublime Text 4 plugin that sends the selected code together with an instruction
to the active zot session through the local HTTP server of
the zot-editor-bridge extension.
Install
Clone the repository into the Sublime Text Packages directory:
git clone https://github.com/unlight/ZotInstruct.git \
"$HOME/.config/sublime-text/Packages/ZotInstruct"
Default locations:
- Linux:
~/.config/sublime-text/Packages/ZotInstruct - macOS:
~/Library/Application Support/Sublime Text/Packages/ZotInstruct - Windows:
%APPDATA%\Sublime Text\Packages\ZotInstruct
Restart Sublime Text or run sublime_plugin.reload_plugin from the console
(Ctrl+`).
No third-party dependencies: the plugin uses the bundled Python 3.8 only.
Key bindings are opt-in. Run Preferences > Package Settings > ZotInstruct >
Example Key Bindings (or Preferences: ZotInstruct Example Key Bindings from
the Command Palette) to open Example.sublime-keymap next to your user keymap,
then copy the alt+enter entries you want. Without bindings use the Command
Palette.
Usage
- Select code or text. Multiple selections are supported and joined with a blank line. With an empty selection the plugin sends only the instruction.
- Press
Alt+Enter(Option+Enteron macOS), if the optional bindings are enabled, or runZot Instruct: Send Selection with Instructionfrom the Command Palette (Ctrl+Shift+P). - Type the instruction in the input panel and press
Enter. The panel is prefilled with the last instruction used for this file in the current Sublime Text session, or with the template for the file extension from the settings. The prefilled text is selected, so it can be replaced immediately.
Additional command:
Zot Instruct: Send Prompt Only(zot_instruct_prompt) sends the instruction without code. This is what the optionalAlt+Enterbinding runs when the selection is empty.
Settings
Preferences > Package Settings > ZotInstruct > Settings opens the settings;
Example Key Bindings opens the example keymap next to your user keymap. Files
in Packages/User/ override the defaults.
| Setting | Default | Meaning |
|---|---|---|
request_timeout |
5 |
HTTP request timeout in seconds. |
instruction_defaults |
see the settings file | Instruction templates per extension; the default key covers the rest. |
Keys in instruction_defaults may list several extensions separated by commas:
"ts,tsx,mts".
Per-project overrides
Add a zot_instruct object to the settings section of a .sublime-project
file:
{
"folders": [{ "path": "." }],
"settings": {
"zot_instruct": {
"request_timeout": 10
}
}
}
These keys override ZotInstruct.sublime-settings for that project only.
zot-editor-bridge integration
The zot-editor-bridge extension runs an HTTP server inside each zot process and
publishes its port in a file named after the session working directory:
editor-bridge-<sha256(cwd)[:8]>.port
The plugin hashes the project root open in Sublime Text (the window folder
containing the active file), normalizes it like Go filepath.Clean, and checks
these locations:
$ZOT_HOME/editor-bridge-<hash>.portwhenZOT_HOMEis set;- otherwise in the zot state directory (
$XDG_STATE_HOME/zotor~/.local/state/zoton Linux,~/Library/Application Support/zoton macOS,%LOCALAPPDATA%\zoton Windows); - when
ZOT_HOMEis unset, the compatible~/.zotcopy.
Start zot in the project root: a session started in a subdirectory hashes to a different file and is not found.
Before sending, the plugin calls GET /health with a one second timeout and
requires the reported cwd to match the project root. A stale file is removed
only if it still contains the same port. Discovery runs on every send, never in
the background.
Each zot window in a different project gets its own file, so requests reach the session started in that project. Two zot windows in the same project share one file: the last started window wins.
To pin the bridge port, set ZOT_EDITOR_BRIDGE_PORT before starting zot; the
port file still receives the actual port in use.
Install the extension:
cd zot-editor-bridge
zot ext install .
Start zot: the extension reports the port on startup. Run /editor-bridge in
zot to print its /send and /health URLs and the port file path.
Troubleshooting
Errors appear in the status bar; details are printed to the Sublime Text console
(Ctrl+`) with the [ZotInstruct] prefix.
zot is not running for this projectmeans no live port file matched the project root: start zot in the project directory.HTTP 4xx/5xxmeans the server returned an error; the response text is shown in the status bar and the console.
Development
python3 tests/selfcheck.py
The plugin targets the Python 3.8 runtime bundled with Sublime Text 4; CI also runs the self-check on Python 3.12.
License
MIT, Copyright © 2026