Skip to content
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

Avoid "aligned" indentations #285

Open
goerz opened this issue Feb 25, 2022 · 2 comments
Open

Avoid "aligned" indentations #285

goerz opened this issue Feb 25, 2022 · 2 comments

Comments

@goerz
Copy link

goerz commented Feb 25, 2022

Using the current master of julia-vim (no other plugins/configuration), I get the following indent behavior:

problem = ControlProblem(
                         X

where X marks the position of the cursor after hitting Enter after the first line.

That is, the indent plugin aligns the indentation with the opening bracket. This is not a style of indentation I wish to use, and not one that is recommended by any of the styles supported by JuliaFormatter. Instead, I'd like to have the second line indented with 4 spaces.

Is there any way to tweak the plugin to achieve this?

@goerz
Copy link
Author

goerz commented Feb 25, 2022

Ah, I found that

let g:julia_indent_align_brackets = 0

solves this.

Two comments:

  • Since the README for this plugin has quite a lot of information, it didn't occur to me to look at the help file (where g:julia_indent_align_brackets is documented). I would maybe recommend either keeping the README minimal and linking to the help file, or alternatively, make sure that everything is documented in the README (and potentially get rid of the help file).

  • I feel like the defaults for the indentation should match what JuliaFormatter would do. Maybe I'm wrong, but I'm assuming that's what everyone is / should be using. The extra indentation for funcargs is another example where this plugin does not match JuliaFormatter (and that one isn't even configurable, see Add option to avoid extra indentation step with julia_indent_align_funcargs = 0 #259)

Feel free to close this issue, unless you want to keep it open for the above two comments

@goerz
Copy link
Author

goerz commented Feb 25, 2022

Of course, the README actually says that it's incomplete, but I missed that part, skimming through ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant