Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/ui/statusline.rs')
-rw-r--r--helix-term/src/ui/statusline.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs
index ea3d27bd..aad3d532 100644
--- a/helix-term/src/ui/statusline.rs
+++ b/helix-term/src/ui/statusline.rs
@@ -158,6 +158,7 @@ where
helix_view::editor::StatusLineElement::Spacer => render_spacer,
helix_view::editor::StatusLineElement::VersionControl => render_version_control,
helix_view::editor::StatusLineElement::Register => render_register,
+ helix_view::editor::StatusLineElement::CurrentWorkingDirectory => render_cwd,
}
}
@@ -573,3 +574,16 @@ where
},
);
}
+
+fn render_cwd<'a, F>(context: &mut RenderContext<'a>, write: F)
+where
+ F: Fn(&mut RenderContext<'a>, Span<'a>) + Copy,
+{
+ let cwd = helix_stdx::env::current_working_dir();
+ let cwd = cwd
+ .file_name()
+ .unwrap_or_default()
+ .to_string_lossy()
+ .to_string();
+ write(context, cwd.into())
+}