Skip to content

$EDITOR handoff

Many command-line tools hand you a file to write and wait for you to finish: git commit, and Claude Code's ⌃G to write a long prompt. Point them at OpenMarkdown and that file opens in a tab instead of in a terminal editor.

macOS and Linux.

Turn on Settings → System integration → $VISUAL editor. It needs the command-line tool on first. New terminals then have:

Terminal window
export VISUAL="openmd --wait --source claude"

The line goes into ~/.zshrc (and ~/.bash_profile or ~/.bashrc if you have one), inside a marked block. Turning the switch off removes the block and nothing else. A VISUAL you set yourself is left alone.

To do it by hand, for one tool, or for EDITOR instead:

Terminal window
export EDITOR="openmd --wait"
git config --global core.editor "openmd --wait"

The file opens in its own tab, in source mode, since a commit message or a prompt is text for a program. A bar names who asked (editing for: git, from --source) and has two buttons:

You The tool gets
Done, ⌘↩, or close the tab Your text, saved. openmd exits 0 and the tool carries on.
Discard openmd exits 3. Git, for one, then aborts the commit. The file itself is not rolled back.

Then the tab closes and you are back where you were.

--wait takes one file. Exit codes and the rest of the options: CLI.