Run command in a terminal
nvim_run_in_terminalRun a shell command inside a Neovim terminal, wait for completion, and fetch its output and exit code. It shares the editor's environment and working directory.
Instructions
Open a terminal inside Neovim, run a single shell command, wait for it to finish, and return its output and exit code. This is the one-shot building block: e.g. run echo hello world and read it back. The terminal runs inside the user's editor, so the command shares the editor's environment and working directory.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cmd | Yes | Shell command to run. | |
| cwd | No | Working directory. Defaults to Neovim's cwd. | |
| shell | No | Shell to use (default: bash if available). | |
| split | No | Where to show the terminal. Default 'horizontal'. | |
| keepOpen | No | Keep the terminal buffer open afterwards. Default false. | |
| timeoutMs | No | Max time to wait for completion in ms. Default 15000. |