commit 16a4c3e9afea064a1997dbf469e1d10c754a7ae8 parent 951d95f447db473cd7c2f1b7ec5aa783352277c5 Author: William Casarin <jb55@jb55.com> Date: Fri, 13 Feb 2026 15:31:36 -0800 dave: use unique temp file names for external editor Avoid vim swap file warnings by generating a unique temp filename each time instead of reusing a fixed name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Diffstat:
| M | crates/notedeck_dave/src/update.rs | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/crates/notedeck_dave/src/update.rs b/crates/notedeck_dave/src/update.rs @@ -621,8 +621,15 @@ pub fn open_external_editor(session_manager: &mut SessionManager) { let session_id = session.id; let input_content = session.input.clone(); - // Create temp file with current input content - let temp_path = std::env::temp_dir().join("notedeck_input.txt"); + // Create temp file with a unique name to avoid vim swap file conflicts + let temp_path = std::env::temp_dir().join(format!( + "notedeck_input_{}.txt", + std::process::id() + ^ (std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_millis() as u32) + .unwrap_or(0)) + )); if let Err(e) = std::fs::write(&temp_path, &input_content) { tracing::error!("Failed to write temp file for external editor: {}", e); return;