Editor Configuration
Typing a five-line prompt in a single-line input is miserable. The :edit command lets you compose prompts in a real editor — VS Code, Vim, Neovim, nano, whatever you prefer — then sends the result to ForgeCode when you save and close.
:edit
Your editor opens a temporary file. Write your prompt, save, close. ForgeCode reads the file and sends it as if you had typed it inline.
Setting Your Editor
ForgeCode checks two environment variables, in order:
| Variable | Scope | Example Value |
|---|---|---|
FORGE_EDITOR | ForgeCode only | code --wait |
EDITOR | System-wide | vim |
FORGE_EDITOR takes priority. If it's set, EDITOR is ignored. If neither is set, :edit has no editor to open and will not work.
FORGE_EDITOR exists for one reason: your preferred system editor and your preferred prompt editor might not be the same. Maybe you use vim for quick system edits but want VS Code for longer prompts. Set FORGE_EDITOR to decouple the two.
VS Code
VS Code needs the --wait flag so ForgeCode knows when you're done editing. Without it, the code command returns immediately and ForgeCode sends an empty prompt.
export FORGE_EDITOR="code --wait"
Vim / Neovim
Vim and Neovim run inside your terminal and block until you quit, so no extra flags are needed:
export EDITOR="vim"
# or
export EDITOR="nvim"
nano
export EDITOR="nano"
Other Editors
Any editor that blocks the calling process until the file is closed will work. The pattern is the same — if your editor returns immediately, look for a "wait" or "block" flag in its docs.
| Editor | Command |
|---|---|
| Sublime Text | subl --wait |
| IntelliJ IDEA | idea --wait |
| Zed | zed --wait |
| Emacs (GUI) | emacsclient -c |
| Emacs (terminal) | emacs -nw |
Where to Set It
Three options, same trade-offs as any environment variable.
~/.env — persistent, ForgeCode-only
ForgeCode loads ~/.env on every run. The variable is invisible to other tools:
# ~/.env
FORGE_EDITOR=code --wait
~/.zshrc (or ~/.bashrc) — persistent, system-wide
Makes the variable available to everything in your shell:
# ~/.zshrc
export EDITOR="vim"
Reload your shell after editing (source ~/.zshrc) or open a new terminal.
Current session — temporary
export FORGE_EDITOR="code --wait"
Gone when the session ends.
When to Use :edit
Inline prompts work fine for short requests. :edit earns its keep when:
- The prompt has structure — steps, lists, code snippets, or multi-paragraph context that's awkward to compose in a single line.
- You want to iterate — write a draft, re-read it, tighten it up before sending. A real editor with cursor movement, undo, and search makes this natural.
- You're pasting content — logs, stack traces, or code blocks are easier to arrange in an editor than at a prompt.
Pair it with multiline input for shorter structured prompts, and reach for :edit when the prompt outgrows inline composition.