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

#15 in Text editors

Download history 984/week @ 2023-12-23 1373/week @ 2023-12-30 1591/week @ 2024-01-06 1576/week @ 2024-01-13 5680/week @ 2024-01-20 6697/week @ 2024-01-27 3365/week @ 2024-02-03 2185/week @ 2024-02-10 2214/week @ 2024-02-17 1886/week @ 2024-02-24 2401/week @ 2024-03-02 4320/week @ 2024-03-09 5095/week @ 2024-03-16 2327/week @ 2024-03-23 2710/week @ 2024-03-30 1732/week @ 2024-04-06

13,035 downloads per month
Used in 58 crates (48 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

~2–12MB
~115K SLoC