diff --git a/book/src/configuration.md b/book/src/configuration.md index fdabe7687dd3..1f32b6578a11 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -218,10 +218,11 @@ tabpad = "·" # Tabs will look like "→···" (depending on tab width) Options for rendering vertical indent guides. -| Key | Description | Default | -| --- | --- | --- | -| `render` | Whether to render indent guides. | `false` | -| `character` | Literal character to use for rendering the indent guide | `│` | +| Key | Description | Default | +| --- | --- | --- | +| `render` | Whether to render indent guides. | `false` | +| `character` | Literal character to use for rendering the indent guide | `│` | +| `skip-levels` | Number of indent levels to skip | `0` | Example: @@ -229,4 +230,5 @@ Example: [editor.indent-guides] render = true character = "╎" +skip-levels = 1 ``` diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 7cb29c3b1ecb..4d450faa5b73 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -436,7 +436,8 @@ impl EditorView { return; } - let starting_indent = (offset.col / tab_width) as u16; + let starting_indent = + (offset.col / tab_width) as u16 + config.indent_guides.skip_levels; // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some // extra loops if the code is deeply nested. diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 5eff998360ef..c6b301ee089e 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -529,15 +529,17 @@ impl Default for WhitespaceCharacters { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(default)] +#[serde(default, rename_all = "kebab-case")] pub struct IndentGuidesConfig { pub render: bool, pub character: char, + pub skip_levels: u16, } impl Default for IndentGuidesConfig { fn default() -> Self { Self { + skip_levels: 0, render: false, character: '│', }