aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorGrzegorz Baranski2021-08-16 02:11:53 +0000
committerGitHub2021-08-16 02:11:53 +0000
commit78923496a6134ab456dbfe8c0a58270d32e4b239 (patch)
tree2e912ea7f8475cdfb8e84570a64e077c946f476b /helix-view
parentaaccc9419a9710f13db3ddc0aad068e606667154 (diff)
feat: relative numbers (#485)
* feat(helix-view): configuring line-number * feat(helix-term): relative line numbers * feat(helix-term): passing editor::Config to render * fix(helix-view): remove LineNumber::None * feat(helix-term): rendering line-number according to configuration * fix(term): put calculating current line above line iteration * fix: add abs_diff function * deps: cargo update * fix: pass config argument
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 413b7913..32f5fe86 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -33,16 +33,29 @@ pub struct Config {
pub scroll_lines: isize,
/// Mouse support. Defaults to true.
pub mouse: bool,
+ /// Line number mode.
+ pub line_number: LineNumber,
/// Middle click paste support. Defaults to true
pub middle_click_paste: bool,
}
+#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
+#[serde(rename_all = "kebab-case")]
+pub enum LineNumber {
+ /// Show absolute line number
+ Absolute,
+
+ /// Show relative line number to the primary cursor
+ Relative,
+}
+
impl Default for Config {
fn default() -> Self {
Self {
scrolloff: 5,
scroll_lines: 3,
mouse: true,
+ line_number: LineNumber::Absolute,
middle_click_paste: true,
}
}