Skip to content

Commit 7edeedb

Browse files
committed
indent: fix end-of-control-block indent if block is empty
1 parent 7c77415 commit 7edeedb

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

indent/cmake.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ fun! CMakeGetIndent(lnum)
105105

106106
if previous_line =~? s:cmake_indent_begin_regex " control begin block
107107
let ind = ind + shiftwidth()
108-
elseif this_line =~? s:cmake_indent_end_regex " control end block
108+
endif
109+
110+
if this_line =~? s:cmake_indent_end_regex " control end block
109111
let ind = ind - shiftwidth()
110112
elseif this_line =~? s:cmake_indent_comment_line
111113
if g:cmake_indent_align_comments_to_first_column == 1

test/if-endif-indent.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if(HELLO)
2+
endif()

test/if-endif-indent.cmake.html.ref

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<body>
2+
<pre id='vimCodeElement'>
3+
<span class="Statement">if</span>(HELLO)
4+
<span class="Statement">endif</span>()
5+
</pre>
6+
</body>

0 commit comments

Comments
 (0)