Skip to content

Commit

Permalink
indent: fix end-of-control-block indent if block is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
pboettch committed Oct 30, 2019
1 parent 7c77415 commit 7edeedb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion indent/cmake.vim
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ fun! CMakeGetIndent(lnum)

if previous_line =~? s:cmake_indent_begin_regex " control begin block
let ind = ind + shiftwidth()
elseif this_line =~? s:cmake_indent_end_regex " control end block
endif

if this_line =~? s:cmake_indent_end_regex " control end block
let ind = ind - shiftwidth()
elseif this_line =~? s:cmake_indent_comment_line
if g:cmake_indent_align_comments_to_first_column == 1
Expand Down
2 changes: 2 additions & 0 deletions test/if-endif-indent.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if(HELLO)
endif()
6 changes: 6 additions & 0 deletions test/if-endif-indent.cmake.html.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<body>
<pre id='vimCodeElement'>
<span class="Statement">if</span>(HELLO)
<span class="Statement">endif</span>()
</pre>
</body>

0 comments on commit 7edeedb

Please sign in to comment.