edit-briefly
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

edit-briefly

buid buid version MIT License

Edit content inside the users preferred editor (via $VISUAL/$EDITOR).

This module is inspired by external-editor. Like the mentioned module, edit-briefly will also allow to you open the user's preferred editor to edit a string. In addition, you can:

  • open the editor with some initial content (think commit message template)
  • set an extension for the temporary file (to enable highliting)
  • move cursor to end of file contents

Install

Requires node 8+.

$ yarn add -D edit-briefly

or

$ npm install -D edit-briefly

Usage

import { edit } from 'edit-briefly';
 
(async () => {
  const contents = await edit();
  // -> resolves when file is closed and file contents is returned
})();

Prefill file and use certain file extension

import { edit } from 'edit-briefly';
 
(async () => {
  const contents = await edit('# Title\n\n', { extension: 'md' });
  // -> opens a temporary existing file with md extension and filled with contents.
})();

Package Sidebar

Install

npm i edit-briefly

Weekly Downloads

13

Version

2.1.0

License

MIT

Unpacked Size

15.6 kB

Total Files

18

Last publish

Collaborators

  • sebastiansebald