on master help sign in
Add option to skip the first indent guide (#3819)
6764744Robin
book/src/configuration.md+6−4
@@ -233,10 +233,11 @@ tabpad = "·" # Tabs will look like "→···" (depending on tab width)
233
233
234Options for rendering vertical indent guides.
234Options for rendering vertical indent guides.
235
235
236−| Key | Description | Default |
236+| Key | Description | Default |
237−| --- | --- | --- |
237+| --- | --- | --- |
238−| `render` | Whether to render indent guides. | `false` |
238+| `render` | Whether to render indent guides. | `false` |
239−| `character` | Literal character to use for rendering the indent guide | `│` |
239+| `character` | Literal character to use for rendering the indent guide | `│` |
240+| `skip-levels` | Number of indent levels to skip | `0` |
240
241
241Example:
242Example:
242
243
@@ -244,4 +245,5 @@ Example:
244[editor.indent-guides]
245[editor.indent-guides]
245render = true
246render = true
246character = "╎"
247character = "╎"
248+skip-levels = 1
247```
249```
helix-term/src/ui/editor.rs+2−1
@@ -436,7 +436,8 @@ impl EditorView {
436 return;
436 return;
437 }
437 }
438
438
439− let starting_indent = (offset.col / tab_width) as u16;
439+ let starting_indent =
440+ (offset.col / tab_width) as u16 + config.indent_guides.skip_levels;
440 // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
441 // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
441 // extra loops if the code is deeply nested.
442 // extra loops if the code is deeply nested.
442
443
helix-view/src/editor.rs+3−1
@@ -552,15 +552,17 @@ impl Default for WhitespaceCharacters {
552}
552}
553
553
554#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
554#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
555−#[serde(default)]
555+#[serde(default, rename_all = "kebab-case")]
556pub struct IndentGuidesConfig {
556pub struct IndentGuidesConfig {
557 pub render: bool,
557 pub render: bool,
558 pub character: char,
558 pub character: char,
559+ pub skip_levels: u16,
559}
560}
560
561
561impl Default for IndentGuidesConfig {
562impl Default for IndentGuidesConfig {
562 fn default() -> Self {
563 fn default() -> Self {
563 Self {
564 Self {
565+ skip_levels: 0,
564 render: false,
566 render: false,
565 character: '│',
567 character: '│',
566 }
568 }