Open
Conversation
CMake has the following end-wise pairings:
* `foreach()` / `endforeach()`
* `function()` / `endfunction()`
* `if()` / `endif()`
* `macro()` / `endmacro()`
* `while()` / `endwhile()`
The `end` forms can take an optional argument, though the argument is ignored. This code leaves that argument empty.
CMake's commands are case-insensitive (e.g., `function()`, `Function()`, `FUNCTION()`, and `fUnCtIoN()` are all equivalent). This code will maintain the case of the opening command and prefix `END` if any only if the command is written in ALL CAPS. In all other cases (i.e., the command is written in lowercase or mixed case), `end` will be prefixed.
Examples:
```cmake
if(SOME_CONDITION)
# ...
endif()
Function(MyFunction)
# ...
endFunction()
WHILE(TRUE)
# ...
ENDWHILE()
```
thetic
added a commit
to thetic/vim-cmake-syntax
that referenced
this pull request
Oct 12, 2019
Derived from (seemingly dead) PR: tpope/vim-endwise#97
yous
added a commit
to yous/dotfiles
that referenced
this pull request
Mar 10, 2020
Brought from: tpope/vim-endwise#97
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMake has the following end-wise pairings:
foreach()/endforeach()function()/endfunction()if()/endif()macro()/endmacro()while()/endwhile()The
endforms can take an optional argument, though the argument is ignored. This code leaves that argument empty.CMake's commands are case-insensitive (e.g.,
function(),Function(),FUNCTION(), andfUnCtIoN()are all equivalent). This code will maintain the case of the opening command and prefixENDif and only if the command is written in ALL CAPS. In all other cases (i.e., the command is written in lowercase or mixed case),endwill be prefixed.Examples: