diff --git a/book/src/editor.md b/book/src/editor.md index 82d5f8461..790e86bbb 100644 --- a/book/src/editor.md +++ b/book/src/editor.md @@ -72,6 +72,7 @@ ### `[editor.statusline]` Section mode.normal = "NORMAL" mode.insert = "INSERT" mode.select = "SELECT" +version-control-prefix = "vcs: " ``` The `[editor.statusline]` key takes the following sub-keys: @@ -84,6 +85,7 @@ ### `[editor.statusline]` Section | `mode.normal` | The text shown in the `mode` element for normal mode | `"NOR"` | | `mode.insert` | The text shown in the `mode` element for insert mode | `"INS"` | | `mode.select` | The text shown in the `mode` element for select mode | `"SEL"` | +| `version-control-prefix` | A prefix for the `version-control` element | `"vcs: "` | The following statusline elements can be configured: diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 7437cbd07..420588e86 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -519,8 +519,13 @@ fn render_version_control(context: &mut RenderContext, write: F) .version_control_head() .unwrap_or_default() .to_string(); + if head.is_empty() { + return; + } - write(context, head, None); + let config = context.editor.config.load(); + let prefix = &config.statusline.version_control_prefix; + write(context, format!("{prefix}{head}"), None); } fn render_register(context: &mut RenderContext, write: F) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index cead30d7c..e7c42ce32 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -468,6 +468,7 @@ pub struct StatusLineConfig { pub right: Vec, pub separator: String, pub mode: ModeConfig, + pub version_control_prefix: String, } impl Default for StatusLineConfig { @@ -492,6 +493,7 @@ fn default() -> Self { ], separator: String::from("│"), mode: ModeConfig::default(), + version_control_prefix: String::from("vcs: "), } } }