| Crates.io | opensesame |
| lib.rs | opensesame |
| version | 0.1.1 |
| created_at | 2025-12-08 01:06:45.286224+00 |
| updated_at | 2025-12-14 23:22:15.29455+00 |
| description | Cross-platform library for opening files in text editors with line:column positioning |
| homepage | https://github.com/epistates/opensesame |
| repository | https://github.com/epistates/opensesame |
| max_upload_size | |
| id | 1972584 |
| size | 90,313 |
A cross-platform Rust library for opening files in text editors with line:column positioning support.
$VISUAL, $EDITOR, or PATH search[dependencies]
opensesame = "0.1"
use opensesame::Editor;
// Open a file in the default editor
Editor::open("src/main.rs")?;
// Open at a specific line (1-indexed)
Editor::open_at("src/main.rs", 42)?;
// Open at a specific line and column
Editor::open_at_position("src/main.rs", 42, 10)?;
For more control, use the builder pattern:
use opensesame::{Editor, EditorKind};
Editor::builder()
.file("src/main.rs")
.line(42)
.column(10)
.wait(true) // Wait for editor to close
.open()?;
// Specify a particular editor
Editor::builder()
.file("src/main.rs")
.editor(EditorKind::VsCode)
.line(42)
.open()?;
// Or by binary name
Editor::builder()
.file("src/main.rs")
.editor_binary("nvim")
.line(42)
.open()?;
| Editor | Binary | Line | Column | Wait |
|---|---|---|---|---|
| VS Code | code |
✓ | ✓ | ✓ |
| VS Code Insiders | code-insiders |
✓ | ✓ | ✓ |
| VSCodium | codium |
✓ | ✓ | ✓ |
| Cursor | cursor |
✓ | ✓ | ✓ |
| Windsurf | windsurf |
✓ | ✓ | ✓ |
| Vim | vim |
✓ | ✓ | - |
| NeoVim | nvim |
✓ | ✓ | - |
| Emacs | emacs |
✓ | ✓ | ✓ |
| Sublime Text | subl |
✓ | ✓ | ✓ |
| Zed | zed |
✓ | ✓ | ✓ |
| Helix | hx |
✓ | ✓ | - |
| Nano | nano |
✓ | ✓ | - |
| TextMate | mate |
✓ | - | ✓ |
| Notepad++ | notepad++ |
✓ | ✓ | - |
| Kate | kate |
✓ | ✓ | - |
| Atom | atom |
✓ | ✓ | ✓ |
| IntelliJ IDEA | idea |
✓ | - | ✓ |
| WebStorm | webstorm |
✓ | - | ✓ |
| PyCharm | pycharm |
✓ | - | ✓ |
| GoLand | goland |
✓ | - | ✓ |
| CLion | clion |
✓ | - | ✓ |
| Xcode | xed |
✓ | - | ✓ |
opensesame detects your preferred editor in this order:
$VISUAL environment variable (preferred for GUI editors)$EDITOR environment variable (traditional editor variable)The environment variables can include arguments:
export VISUAL="code --wait"
export EDITOR="nvim"
opensesame provides rich error types:
use opensesame::{Editor, Error};
match Editor::open("src/main.rs") {
Ok(()) => println!("Opened successfully"),
Err(Error::NoEditorFound) => println!("No editor configured"),
Err(Error::EditorNotFound { binary }) => println!("{binary} not found"),
Err(Error::FileNotFound { path }) => println!("{} not found", path.display()),
Err(e) => println!("Error: {e}"),
}
MIT