Short command name: cxpaste
Solves a core Codex-cli pain point: multi-line content cannot be pasted directly.
Avoids manual paste issues such as incorrect behavior, missing lines, broken formatting, and repeated operations.
Put the following files in the same directory:
cxpaste.execxpaste.ini
In Windows advanced system settings, set environment variable VISUAL or EDITOR to the program path.
Note: wrap the path with English double quotes to avoid errors when the path contains spaces, such as:
Failed to open editor: The system cannot find the file specified. (os error 2).
VISUAL = "D:\MyProgarm\cxpaste.exe"
or
EDITOR = "D:\MyProgarm\cxpaste.exe"
Notes:
VISUALhas higher priority;EDITORis used whenVISUALis not set.
Copy the text you want to paste, then press Ctrl+G in Codex.
Help commands:
cxpaste -h
cxpaste --helpBy default, the program reads cxpaste.ini from the current directory.
Common config example:
[write]
mode=append ; append / overwrite write mode
[append]
trim_existing=false ; whether to trim leading/trailing blank lines of existing text (already in Codex input)
trim_incoming=true ; whether to trim leading/trailing blank lines of incoming text (about to append)
join_with=none ; text join style: none / single_newline / double_newline
[overwrite]
trim_content=true ; whether to trim leading/trailing blank lines of incoming text (about to overwrite)Notes:
The program has 2 modes.
-
Append mode
When the Codex input box already has text, append clipboard text after it.
-
Overwrite mode
Directly replace Codex input box text with clipboard text.
[append]applies in append mode.trim_existingandtrim_incomingcontrol blank-line cleanup for original Codex text and appended text.join_withcontrols how original text and appended text are connected, including whether to insert one or two newlines; default is direct concatenation.[overwrite]applies in overwrite mode.trim_contentcontrols whether leading/trailing blank lines are removed from new text.
- Windows only (currently tested on Windows 10, Windows Terminal, PowerShell 7)
- Depends on Windows clipboard and config APIs (for example
CF_UNICODETEXT,GetPrivateProfileStringW)
gcc -Wall -Wextra -O2 -municode -o cxpaste.exe cxpaste.c