Files
CMake/Auxiliary/vim
Kai Tetzlaff b14cfbe159 vim: Fix indentation of 'closing parens only lines'
This commit changes the indentation of lines which contain only closing
parentheses (`)`).

Example:

Change
```
add_library(mylib
    mysrc.c
    )
```
to:
```
add_library(mylib
    mysrc.c
)
```

There are edge cases, where the indentation still doesn't really work.

Example:

This, admittedly weird, piece of code (manually formatted to what I would
expect - this is already a personal preference ...):
```
if(4)
    if((0 OR 1
       )
      ) # could also be aligned with the `i` in `if`
        set(foobar
        )
    endif()
    set(foobar)
endif()
```
will be changed to:
```
if(4)
    if((0 OR 1
)
    )
    set(foobar
    )
endif()
set(foobar)
endif()
```
whereas with the previous vim indentation code the result would have been:
```
if(4)
    if((0 OR 1
        )
    )
set(foobar
    )
    endif()
    set(foobar)
endif()
```
which is not great but better than above. I hope that this is acceptable.


Note: Apart from the actual indentation fixes, I based the change on a version
of indent/cmake.vim I found in the debian/bookworm vim82 package which is newer
than the one in the cmake repository (with `Last Change:  2017 Sep 24` comment
instead of the cmake repo version with `Last Change:  2017 Aug 30`).

This vim82/debian version moved these two lines:
```
let s:keepcpo= &cpo
set cpo&vim
```
a bit further down (after an early exit check - which seems to make sense to
me).


Fixes: #22394
2022-03-22 18:18:20 +01:00
..
2022-03-09 12:17:44 -05:00