JuliaEditorSupport / julia-vim

Vim support for Julia.
http://julialang.org/
Other
753 stars 94 forks source link

Closing parenthesis indentation using g:julia_indent_align_brackets = 0 #220

Closed dgkf closed 3 years ago

dgkf commented 3 years ago

Using g:julia_indent_align_brackets = 0, the closing parenthesis of a nested parenthesis block receives no indentation:

# as it is now
reduce(+,
    map(
        i -> i * 2,
        [1, 2, 3]
)
)

# expected
reduce(+,
    map(
        i -> i * 2,
        [1, 2, 3]
    )
)

I made a quick fix to my local indent/julia.vim that seems to be working, but I'm still testing it out to try to gauge whether it breaks other indentation:

https://github.com/JuliaEditorSupport/julia-vim/blob/a4bc8a2032e9da4dbfc5f527c2415b68fc09b9bd/indent/julia.vim#L398-L399

      if !align_brackets && !align_funcargs
-        let ind = -1
+        call JumpToMatch(v:lnum, indent(v:lnum))
+        return indent(line("."))              

I'm happy to help iterate on this if there are other scenarios that I might be overlooking.

carlobaldassi commented 3 years ago

Thanks, I have used your fix, it seems ok to me.