Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable smart indent? #1725

Closed
emi2k01 opened this issue Mar 1, 2022 · 4 comments
Closed

How to disable smart indent? #1725

emi2k01 opened this issue Mar 1, 2022 · 4 comments
Labels
A-helix-term Area: Helix term improvements C-discussion Category: Discussion or questions that doesn't represent real issues

Comments

@emi2k01
Copy link

emi2k01 commented Mar 1, 2022

I'd like auto-indentation to always use the indentation of the previous line.

I have this (| is the cursor)

  yo {|
  }

I press enter and I'd like to have this

  yo {
  |
  }

In C-like languages this always increases the indentation but I'd like to deactivate that.

Is this possible? Thanks.

EDIT: dammit, I just remembered Discussions exist, sorry!

@kirawi
Copy link
Member

kirawi commented Mar 2, 2022

I don't think there's a config option available, but you should be able to delete the indents.toml for the associated language in your runtime/queries folder.

Edit: NVM, I misunderstood.

@kirawi kirawi added A-helix-term Area: Helix term improvements C-discussion Category: Discussion or questions that doesn't represent real issues labels Mar 2, 2022
@emi2k01
Copy link
Author

emi2k01 commented Mar 6, 2022

What I want is the equivalent of set autoindent and set indentexpr= in vim. If this is a feature that would be accepted, I could implement it after discussing how the feature would look like.

@seasonedfish
Copy link

Seconding this feature. The Haskell indentation is a bit wonky, so I was looking for a way to make the indentation always use the level of the previous line.

@Triton171
Copy link
Contributor

Haskell doesn't yet have indent queries, so smart indent is automatically disabled there. Maybe your issue is that the "dumb" indent copies the indentation level and not the indent string. This means that if the indentation is rounded down to the nearest indent level, which could cause issues. Another problem might be the auto-detection of the indent style that Helix does. If for example a large fraction of the lines in your file are aligned to something, the heuristic might guess an incorrect indentation style.

I implemented an option for choosing the indentation heuristic in #8307. @emi2k01, your issue is caused by the auto-pairs code, so currently the only way to change that behavior would be to exclude curly braces from auto-pairing.

@helix-editor helix-editor locked and limited conversation to collaborators Apr 7, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10253 Apr 7, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
A-helix-term Area: Helix term improvements C-discussion Category: Discussion or questions that doesn't represent real issues
Projects
None yet
Development

No branches or pull requests

4 participants