@inquirer/external-editor

Open your default text editor to edit strings in Node.js programs

npmmacoslinuxwindows
Try with needOr install directly
Source

About

Edit a string with the users preferred text editor using $VISUAL or $ENVIRONMENT

Examples

let user edit text in their preferred editor$ const { externalEditor } = require('@inquirer/external-editor'); const result = await externalEditor();
start with pre-filled text that user can modify$ const result = await externalEditor({ default: 'initial content here' });
launch editor for composing long messages or descriptions$ const message = await externalEditor({ postfix: '.md' });
get edited text from users in interactive command line prompts$ const answer = await externalEditor({ validate: (text) => text.length > 0 });
open vim or nano or whatever editor user has set as default$ const edited = await externalEditor({ validate: (text) => !text.includes('TODO') || 'Remove TODO before saving' });