aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index a2943af9..51c0eee0 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -147,6 +147,8 @@ pub struct Config {
/// Whether to display infoboxes. Defaults to true.
pub auto_info: bool,
pub file_picker: FilePickerConfig,
+ /// Configuration of the statusline elements
+ pub statusline: StatusLineConfig,
/// Shape for cursor in each mode
pub cursor_shape: CursorShapeConfig,
/// Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. Defaults to `false`.
@@ -180,6 +182,54 @@ pub struct SearchConfig {
pub wrap_around: bool,
}
+#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
+pub struct StatusLineConfig {
+ pub left: Vec<StatusLineElement>,
+ pub center: Vec<StatusLineElement>,
+ pub right: Vec<StatusLineElement>,
+}
+
+impl Default for StatusLineConfig {
+ fn default() -> Self {
+ use StatusLineElement as E;
+
+ Self {
+ left: vec![E::Mode, E::Spinner, E::FileName],
+ center: vec![],
+ right: vec![E::Diagnostics, E::Selections, E::Position, E::FileEncoding],
+ }
+ }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum StatusLineElement {
+ /// The editor mode (Normal, Insert, Visual/Selection)
+ Mode,
+
+ /// The LSP activity spinner
+ Spinner,
+
+ /// The file nane/path, including a dirty flag if it's unsaved
+ FileName,
+
+ /// The file encoding
+ FileEncoding,
+
+ /// The file type (language ID or "text")
+ FileType,
+
+ /// A summary of the number of errors and warnings
+ Diagnostics,
+
+ /// The number of selections (cursors)
+ Selections,
+
+ /// The cursor position
+ Position,
+}
+
// Cursor shape is read and used on every rendered frame and so needs
// to be fast. Therefore we avoid a hashmap and use an enum indexed array.
#[derive(Debug, Clone, PartialEq)]
@@ -409,6 +459,7 @@ impl Default for Config {
completion_trigger_len: 2,
auto_info: true,
file_picker: FilePickerConfig::default(),
+ statusline: StatusLineConfig::default(),
cursor_shape: CursorShapeConfig::default(),
true_color: false,
search: SearchConfig::default(),