Skip to content

antnesswcm/codex-cli-multiline-paster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codex-cli-multiline-paster

Short command name: cxpaste

中文说明

Purpose

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.

Usage

1. Download

Download from releases

Put the following files in the same directory:

  • cxpaste.exe
  • cxpaste.ini

2. Configure environment variables (for Codex Ctrl+G trigger)

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:

  • VISUAL has higher priority; EDITOR is used when VISUAL is not set.

3. Use in Codex

Copy the text you want to paste, then press Ctrl+G in Codex.

Help commands:

cxpaste -h
cxpaste --help

By 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.

  1. Append mode

    When the Codex input box already has text, append clipboard text after it.

  2. Overwrite mode

    Directly replace Codex input box text with clipboard text.

  • [append] applies in append mode.
  • trim_existing and trim_incoming control blank-line cleanup for original Codex text and appended text.
  • join_with controls 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_content controls whether leading/trailing blank lines are removed from new text.

Runtime Platform

  • Windows only (currently tested on Windows 10, Windows Terminal, PowerShell 7)
  • Depends on Windows clipboard and config APIs (for example CF_UNICODETEXT, GetPrivateProfileStringW)

Build

gcc -Wall -Wextra -O2 -municode -o cxpaste.exe cxpaste.c

About

cxpaste:解决 Codex 多行内容粘贴。cxpaste: Effortlessly paste multi-line content into Codex CLI.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages