I'm using vim-polyglot
for my vim, which uses julia-vim. When I try to automatically indent my function definition using the vim command =
, I get this:
function calculate_pd_change_overall(
data,
shock_year = nothing,
end_of_analysis = nothing,
risk_free_interest_rate = nothing
)
whereas if I use JuliaFormatter.jl (via https://github.com/kdheepak/JuliaFormatter.vim), there are no 2-spaces preceding the closing parentheses.
It is instead
function calculate_pd_change_overall(
data,
shock_year = nothing,
end_of_analysis = nothing,
risk_free_interest_rate = nothing
)
I think the latter one is more correct? How do I configure julia-vim to be like JuliaFormatter.jl?
Update: I was setting the wrong config.
This is solved by adding
let g:julia_indent_align_brackets=0
in the vimrc. Wonder why this is not the default? Should I raise an issue upstream at https://github.com/JuliaEditorSupport/julia-vim?
I think the latter one is more correct?
Is there a "more correct" here? afaik it's a matter of stylistic preference, and I, for example, slightly prefer the former one (the current default). The Blue style does seem to prefer the unindented closing paren, but I don't think it's so widely agreed upon that it should necessarily set the defaults.
I looked at the stdlib, found https://github.com/JuliaLang/julia/blob/47255f9fe866758472e2420e475bd174d0ba70d5/stdlib/LinearAlgebra/src/cholesky.jl#L166-L167 which is not properly indented?
Just looking for examples for which style is used in the stdlib.
Rein Zustand has marked this topic as resolved.
Last updated: Nov 06 2024 at 04:40 UTC