Add register statusline element (#7222)
This commit is contained in:
parent
993c68ad6f
commit
00b152facd
3 changed files with 21 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue