Edit a string with the users preferred text editor using $VISUAL or $ENVIRONMENT
79
A utility that selects a terminal editor from environment preferences and runs it while exposing resolved command details.
VISUAL when set; VISUAL="nano --wait" yields bin "nano", args ["--wait"] while EDITOR is ignored @testEDITOR when VISUAL is missing; EDITOR="code --wait --new-window" yields bin "code", args ["--wait", "--new-window"] @test"vim" on non-Windows, "notepad" on Windows) when neither variable is set @test@generates
export type EditorCommand = {
bin: string;
args: string[];
};
export type EditorRunResult = {
content: string;
command: EditorCommand;
exitStatus: number | null;
};
/**
* Resolves the editor command to run based on VISUAL, EDITOR, or platform fallback.
* @param env optional environment values to inspect
*/
export function resolveEditor(env?: NodeJS.ProcessEnv): EditorCommand;
/**
* Runs an editable session using the resolved editor.
* @param initialText optional prefilled contents
* @param env optional environment values to inspect
*/
export function runEditorSession(initialText?: string, env?: NodeJS.ProcessEnv): Promise<EditorRunResult>;Launches a user-configured external editor and exposes the resolved command and args. @satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-external-editordocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10