The script editor

The script pane is Fresh, a terminal editor without modes, with VS Code's shortcuts, menus and mouse. Corral adds running code in the console, a temporary draft, completion from your live R session and formatting on save.

Run code

The file decides the console: code from a .R file goes to R and code from a .py file goes to Python, which comes into view (and starts, the first time). Keyboard shortcuts lists every key.

In Python

Ctrl+R sends the whole statement under the cursor: a function with all its body (blank lines included), an if with its else, a call spread over several lines, or a function with its decorators. The code reaches IPython as one pasted block and shows up at In [n]:. A selection is sent without its common indentation. F5 runs the file with %run -i, which leaves the variables in the session. Ctrl+L and Ctrl+U do nothing in a .py file.

From any pane

Select text with the mouse in any pane, for example code Claude wrote; herdr copies it on its own. Then press ctrl+b enter to run it in the console in view. Without a selection, it sends what is in the clipboard.

The draft

Each layout opens a new, empty draft.R inside the project, in .corral/<workspace>-<date>/. Being in the project means Air, lintr and the language server use the project's configuration (air.toml, .lintr, DESCRIPTION, renv.lock).

Corral creates .corral/.gitignore with *, so git doesn't see those files and you don't have to touch your .gitignore. The file explorer doesn't show .corral/ because its name starts with a dot.

The draft is deleted when you close the editor, its pane or the layout. If something closes the editor abruptly, the abandoned draft is deleted the next time you open a layout in that project. A file you saved by hand in the draft's folder is kept, and that folder is deleted after two days.

If you open the layout in your home folder, or in a folder you can't write to, the draft goes to $XDG_RUNTIME_DIR/corral/borradores/, which WSL empties when it restarts.

The draft is a real file, and not an "untitled" buffer, because completion only works in saved files. New untitled files open as R, without completion until you save them.

Save your work

The draft is lost when the layout closes, unless you save it:

$ corral script --read
$ corral script --save analisis/modelo.R

--read prints the current draft, unsaved edits included. --save refuses to replace an existing file unless you add --force.

Completion and diagnostics

Completion appears in a menu while you type. You also get help when you hover over a function, its signature when you open the parenthesis, and go to definition. Diagnostics show only real problems: style is never flagged, because the formatter fixes it when you save.

R with Ark

With Ark as the console (the default), the same R as your console gives the completion, so it knows your session: autos$ offers the columns of your autos. The diagnostics are Ark's, mostly syntax errors.

Plain R

With plain R as the console, completion comes from the languageserver package, which only sees the text of your files. The diagnostics are lintr's correctness rules (an object that doesn't exist, x == NA, a repeated argument), or the project's .lintr if it has one.

Fresh starts the server with corral _lsp, which picks Ark's or languageserver according to the console.

Python

Completion, help and go to definition come from ty, which reads the project's .venv and so knows your packages. ty can check types too, but Corral turns those diagnostics off so they don't repeat Ruff's. The diagnostics are Ruff's, with its default rules: real errors such as undefined names, unused imports and syntax errors. If the project has a Ruff configuration in pyproject.toml or ruff.toml, Ruff uses it.

ty is still a 0.0 version. If something fails, go back to python-lsp-server; the change applies when the editor opens again:

$ corral config python_lsp pylsp
$ corral config python_lsp ty

The project folder

The language server reads every R file in the project folder. Fresh finds that folder by going up from the open file until it finds .corral, .git, DESCRIPTION, renv.lock or another marker.

Formatting and indentation

Reopen the editor after a change

Each editor reads its configuration and plugins when it opens. If you change Fresh's config.json or Corral's plugin, close the editor with Ctrl+Q (save the draft first if you need it) and open the layout again with ctrl+b a. The same goes for a shortcut you change with corral keys --change.

Corral's editor settings are in fresh/config.json and its plugin in fresh/plugins/corral.ts, in Corral's folder. Fresh comes with update checks and telemetry turned off (check_for_updates: false). Corral also turns off the Fresh plugins it doesn't use, such as agent orchestration (herdr does that already), welcome screens, Kubernetes, devcontainers, and languages like C# or C++.

Agents in the draft

Claude can read your draft and put code into it. The text goes at the end, on a new line, as one edit you can undo with Ctrl+Z, and your unsaved work stays:

$ echo 'resumen <- summary(autos)' | corral script --write

--write reads the text from stdin, or from a file you name. With --replace, it replaces the whole draft. The editor doesn't let other programs change a buffer you haven't saved, so Corral leaves the request next to the draft and its editor plugin applies it.

Corral's skill tells Claude to replace the draft only when you ask, and never to save it on its own: the draft is temporary on purpose. See Working with agents.