@@ -1557,7 +1557,8 @@ mod cmd {
15571557 let (_, doc) = current!(cx.editor);
15581558
15591559 if let Some(path) = path {
1560− doc.set_path(path.as_ref()).context("invalid filepath")?;
1560+ doc.set_path(Some(path.as_ref()))
1561+ .context("invalid filepath")?;
15611562 }
15621563 if doc.path().is_none() {
15631564 bail!("cannot write a buffer without a filename");
@@ -2099,6 +2100,18 @@ mod cmd {
20992100 Ok(())
21002101 }
21012102
2103+ fn tutor(
2104+ cx: &mut compositor::Context,
2105+ _args: &[&str],
2106+ _event: PromptEvent,
2107+ ) -> anyhow::Result<()> {
2108+ let path = helix_core::runtime_dir().join("tutor.txt");
2109+ cx.editor.open(path, Action::Replace)?;
2110+ // Unset path to prevent accidentally saving to the original tutor file.
2111+ doc_mut!(cx.editor).set_path(None)?;
2112+ Ok(())
2113+ }
2114+
21022115 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
21032116 TypableCommand {
21042117 name: "quit",
@@ -2351,7 +2364,14 @@ mod cmd {
23512364 doc: "Open the file in a horizontal split.",
23522365 fun: hsplit,
23532366 completer: Some(completers::filename),
2354− }
2367+ },
2368+ TypableCommand {
2369+ name: "tutor",
2370+ aliases: &[],
2371+ doc: "Open the tutorial.",
2372+ fun: tutor,
2373+ completer: None,
2374+ },
23552375 ];
23562376
23572377 pub static COMMANDS: Lazy<HashMap<&'static str, &'static TypableCommand>> = Lazy::new(|| {