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

Strange indentation behaviour with function calls in top-level definitions of multi-line arrays #23

Open
maxcutlyp opened this issue Jan 31, 2022 · 1 comment
Assignees

Comments

@maxcutlyp
Copy link

maxcutlyp commented Jan 31, 2022

Specifically, if

  • the last item in the array is a function call (i.e. has (...) at the end - note that it must have the ( as well as the ))
  • the last item in the array does not have a trailing ,
  • the array is defined at the first indentation level
  • the closing ); is on its own line

then the line after the closing ); will be indented one tabstop further than it should be. If any of the above conditions are not met, indentation behaves as expected.

See the below video:
https://user-images.githubusercontent.com/46881987/151777293-b2116c88-c616-4046-bead-420b19cfcee4.mp4

Also note the double indentation of the array contents (and the closing );), although this is not the focus of this issue.

@tikhomirov tikhomirov self-assigned this Feb 6, 2022
@tikhomirov
Copy link
Owner

Thank you for such a detailed report! Indentation looks strange but surprisingly it's Vim's default behavior (i.e. behavior you described isn't specific to this plugin; it's the same for C, C , Java, or JavaScript). You can check :h C-indent for more details but I could not find a way to fix behavior from your video.

Also note the double indentation of the array contents (and the closing );), although this is not the focus of this issue.

This can be changed with :set cino=(0,m1

I'm not closing this issue because I would like to investigate it a bit further and maybe find settings that will change the described behavior to something more expected.

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

2 participants