cmd-ui API provides an interactive menu for managing saved terminal commands. This allows you to store frequently-used commands and execute them in any terminal with a visual interface.
The command UI is separate from the file navigation UI. It’s specifically designed for managing terminal commands that can be sent to terminals.
toggle_quick_menu
Opens or closes the command menu showing all saved terminal commands.Behavior
- If the menu is already open, it closes the menu
- If closed, opens a floating window showing all saved commands from the terminal config
- Commands can be edited directly in the menu
- Menu respects
save_on_toggleandsave_on_changesettings - Line numbers are displayed for easy reference
Keybindings
When the command menu is open:- Enter - Select command and prompt for terminal index to send it to
- q or ESC - Close the menu
- Edit commands directly and they will be saved (if
save_on_changeis true)
Example
select_menu_item
Selects a command from the menu and prompts for a terminal index to send it to.Behavior
- Gets the command at the current cursor line
- Closes the menu (with save if needed)
- Prompts user to input a terminal index (defaults to 1 if empty)
- Sends the selected command to the specified terminal using
term.sendCommand()
Example
on_menu_save
Saves changes made in the command menu back to the terminal command list.Behavior
- Reads all lines from the command menu buffer
- Filters out whitespace-only lines
- Updates the terminal command list using
term.set_cmd_list() - Triggered automatically based on
save_on_toggleandsave_on_changesettings
Example
Complete Workflow Example
Here’s a complete workflow using the command UI:Adding Commands Programmatically
You can also add commands programmatically without using the menu:Configuration
The command UI respects these global settings:Save commands when toggling the menu open/closed
Auto-save commands as you edit them in the menu
Integration with Terminal API
The command UI works seamlessly with the Terminal API:Terminal API
Learn more about the Terminal API and command execution