mirror of https://github.com/helix-editor/helix
Add option to skip the first indent guide (#3819)
* Add option to skip the first indent guide * reorder skip_first option * change indent-guides.skip_first to a number * rename skip -> skip_levels * add skip_levels to the book * Update book/src/configuration.md Co-authored-by: A-Walrus <58790821+A-Walrus@users.noreply.github.com> * Update helix-term/src/ui/editor.rs Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: Robin <robinvandijk@klippa.com> Co-authored-by: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>pull/4085/head
parent
dbec057363
commit
6764744ce9
|
@ -237,6 +237,7 @@ Options for rendering vertical indent guides.
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `render` | Whether to render indent guides. | `false` |
|
| `render` | Whether to render indent guides. | `false` |
|
||||||
| `character` | Literal character to use for rendering the indent guide | `│` |
|
| `character` | Literal character to use for rendering the indent guide | `│` |
|
||||||
|
| `skip-levels` | Number of indent levels to skip | `0` |
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
@ -244,4 +245,5 @@ Example:
|
||||||
[editor.indent-guides]
|
[editor.indent-guides]
|
||||||
render = true
|
render = true
|
||||||
character = "╎"
|
character = "╎"
|
||||||
|
skip-levels = 1
|
||||||
```
|
```
|
||||||
|
|
|
@ -436,7 +436,8 @@ impl EditorView {
|
||||||
return;
|
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
|
// 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.
|
// extra loops if the code is deeply nested.
|
||||||
|
|
||||||
|
|
|
@ -552,15 +552,17 @@ impl Default for WhitespaceCharacters {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default, rename_all = "kebab-case")]
|
||||||
pub struct IndentGuidesConfig {
|
pub struct IndentGuidesConfig {
|
||||||
pub render: bool,
|
pub render: bool,
|
||||||
pub character: char,
|
pub character: char,
|
||||||
|
pub skip_levels: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for IndentGuidesConfig {
|
impl Default for IndentGuidesConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
skip_levels: 0,
|
||||||
render: false,
|
render: false,
|
||||||
character: '│',
|
character: '│',
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue