diff options
author | Kai Tetzlaff <cmake@tetzco.de> | 2022-03-22 16:28:59 (GMT) |
---|---|---|
committer | Kai Tetzlaff <cmake@tetzco.de> | 2022-03-22 17:18:20 (GMT) |
commit | b14cfbe15902e5ec9142271864ffaf5fe5ebb7dc (patch) | |
tree | c5c880835053c7ca4eb7f99a97056358fdab70de /.gitlab | |
parent | b5b4ae17dcbc3ad813fca074478611afb1700232 (diff) | |
download | CMake-b14cfbe15902e5ec9142271864ffaf5fe5ebb7dc.zip CMake-b14cfbe15902e5ec9142271864ffaf5fe5ebb7dc.tar.gz CMake-b14cfbe15902e5ec9142271864ffaf5fe5ebb7dc.tar.bz2 |
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
Diffstat (limited to '.gitlab')
0 files changed, 0 insertions, 0 deletions