use std::fs::File;
use std::io::Read;
use std::process::Command;
use tempfile::NamedTempFile;
pub fn edit_with_vim() -> Result<String, Box<dyn std::error::Error>> {
let file = NamedTempFile::new()?;
let file_path = file.path().to_str().unwrap_or_default().to_string();
Command::new("vim").arg(&file_path).status()?;
let mut contents = String::new();
let mut file = File::open(file_path)?;
file.read_to_string(&mut contents)?;
Ok(contents)
}