aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorDan Cardamore2024-03-17 22:55:49 +0000
committerGitHub2024-03-17 22:55:49 +0000
commit3890376a23e84d5bcdac31cb9d0f6913abe0fc7f (patch)
tree4df823dd99b6831c32c07d3d0837103e6d1edae4 /helix-term
parente36774c2c8f967c16ce2e10f2ba074838b324ec6 (diff)
add 'file-absolute-path' to statusline (#4535)
* feat: add 'file-abs-path' to statusline (#4434) * cleanup implementation * rename to be non-abbreviated names --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/statusline.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs
index 9871828e..c3464067 100644
--- a/helix-term/src/ui/statusline.rs
+++ b/helix-term/src/ui/statusline.rs
@@ -142,6 +142,7 @@ where
helix_view::editor::StatusLineElement::Spinner => render_lsp_spinner,
helix_view::editor::StatusLineElement::FileBaseName => render_file_base_name,
helix_view::editor::StatusLineElement::FileName => render_file_name,
+ helix_view::editor::StatusLineElement::FileAbsolutePath => render_file_absolute_path,
helix_view::editor::StatusLineElement::FileModificationIndicator => {
render_file_modification_indicator
}
@@ -430,6 +431,22 @@ where
write(context, title, None);
}
+fn render_file_absolute_path<F>(context: &mut RenderContext, write: F)
+where
+ F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
+{
+ let title = {
+ let path = context.doc.path();
+ let path = path
+ .as_ref()
+ .map(|p| p.to_string_lossy())
+ .unwrap_or_else(|| SCRATCH_BUFFER_NAME.into());
+ format!(" {} ", path)
+ };
+
+ write(context, title, None);
+}
+
fn render_file_modification_indicator<F>(context: &mut RenderContext, write: F)
where
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,