6 releases

0.1.5 Dec 17, 2023
0.1.4 Jun 1, 2022
0.1.3 Feb 26, 2021
0.1.2 Jul 6, 2020
0.1.1 Jan 22, 2020

#7 in Text editors

Download history 2611/week @ 2024-08-15 2525/week @ 2024-08-22 5837/week @ 2024-08-29 7320/week @ 2024-09-05 5519/week @ 2024-09-12 3418/week @ 2024-09-19 4131/week @ 2024-09-26 3871/week @ 2024-10-03 4005/week @ 2024-10-10 3263/week @ 2024-10-17 4380/week @ 2024-10-24 6084/week @ 2024-10-31 5353/week @ 2024-11-07 6669/week @ 2024-11-14 9853/week @ 2024-11-21 6878/week @ 2024-11-28

29,633 downloads per month
Used in 70 crates (59 directly)

CC0 license

16KB
154 lines

edit

crates.io docs.rs

edit is a Rust library that lets you open and edit something in a text editor, regardless of platform. (Think git commit.)

It works on Windows, Mac, and Linux, and knows about lots of different text editors to fall back upon in case standard environment variables such as VISUAL and EDITOR aren't set.

let template = "Fill in the blank: Hello, _____!";
let edited = edit::edit(template)?;
println!("after editing: '{}'", edited);
// after editing: 'Fill in the blank: Hello, world!'

lib.rs:

edit lets you open and edit something in a text editor, regardless of platform. (Think git commit.)

It works on Windows, Mac, and Linux, and knows about lots of different text editors to fall back upon in case standard environment variables such as VISUAL and EDITOR aren't set.

let template = "Fill in the blank: Hello, _____!";
let edited = edit::edit(template)?;
println!("after editing: '{}'", edited);
// after editing: 'Fill in the blank: Hello, world!'

Features

The edit crate has the following optional features:

  • better-path (enabled by default) — Use which to locate executable programs in PATH. If this is disabled, programs are still looked up in PATH, but a basic search is used that does not check for executability.

  • quoted-env — Use shell-words to split apart the values of the VISUAL and EDITOR environment variables. If this is disabled, the envvars are split up on whitespace.

Dependencies

~1.6–9.5MB
~112K SLoC