aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--book/src/configuration.md1
-rw-r--r--helix-term/src/ui/statusline.rs10
-rw-r--r--helix-view/src/editor.rs11
3 files changed, 21 insertions, 1 deletions
diff --git a/book/src/configuration.md b/book/src/configuration.md
index 5df63207..b7ddfdef 100644
--- a/book/src/configuration.md
+++ b/book/src/configuration.md
@@ -117,6 +117,7 @@ The following statusline elements can be configured:
| `separator` | The string defined in `editor.statusline.separator` (defaults to `"│"`) |
| `spacer` | Inserts a space between elements (multiple/contiguous spacers may be specified) |
| `version-control` | The current branch name or detached commit hash of the opened workspace |
+| `register` | The current selected register |
### `[editor.lsp]` Section
diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs
index dbf5ac31..61fca609 100644
--- a/helix-term/src/ui/statusline.rs
+++ b/helix-term/src/ui/statusline.rs
@@ -160,6 +160,7 @@ where
helix_view::editor::StatusLineElement::Separator => render_separator,
helix_view::editor::StatusLineElement::Spacer => render_spacer,
helix_view::editor::StatusLineElement::VersionControl => render_version_control,
+ helix_view::editor::StatusLineElement::Register => render_register,
}
}
@@ -489,3 +490,12 @@ where
write(context, head, None);
}
+
+fn render_register<F>(context: &mut RenderContext, write: F)
+where
+ F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
+{
+ if let Some(reg) = context.editor.selected_register {
+ write(context, format!(" reg={} ", reg), None)
+ }
+}
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 1f27603c..b999836f 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -403,7 +403,13 @@ impl Default for StatusLineConfig {
E::FileModificationIndicator,
],
center: vec![],
- right: vec![E::Diagnostics, E::Selections, E::Position, E::FileEncoding],
+ right: vec![
+ E::Diagnostics,
+ E::Selections,
+ E::Register,
+ E::Position,
+ E::FileEncoding,
+ ],
separator: String::from("│"),
mode: ModeConfig::default(),
}
@@ -484,6 +490,9 @@ pub enum StatusLineElement {
/// Current version control information
VersionControl,
+
+ /// Indicator for selected register
+ Register,
}
// Cursor shape is read and used on every rendered frame and so needs