diff --git a/book/src/editor.md b/book/src/editor.md index ba03e90e5..35e65200c 100644 --- a/book/src/editor.md +++ b/book/src/editor.md @@ -92,6 +92,7 @@ The following statusline elements can be configured: | `file-name` | The path/name of the opened file | | `file-absolute-path` | The absolute path/name of the opened file | | `file-base-name` | The basename of the opened file | +| `workspace` | The current workspace, along with current working directory | | `file-modification-indicator` | The indicator to show whether the file is modified (a `[+]` appears when there are unsaved changes) | | `file-encoding` | The encoding of the opened file if it differs from UTF-8 | | `file-line-ending` | The file line endings (CRLF or LF) | diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 7437cbd07..a3a0458ac 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -163,6 +163,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::Workspace => render_workspace, } } @@ -531,3 +532,84 @@ where write(context, format!(" reg={} ", reg), None) } } + +fn render_workspace(context: &mut RenderContext, write: F) +where + F: Fn(&mut RenderContext, String, Option