diff options
author | Christian Clason <c.clason@uni-graz.at> | 2023-12-15 01:08:19 +0100 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2023-12-15 10:30:13 +0100 |
commit | 34f008e2472425ff89cd58b4ecca633e7d70290c (patch) | |
tree | d0c270e607f2ea74cb4abfdb21c291ef101db61a /runtime/indent | |
parent | 65032e03e0c43aa847665933c27cfc477b527968 (diff) | |
download | rneovim-34f008e2472425ff89cd58b4ecca633e7d70290c.tar.gz rneovim-34f008e2472425ff89cd58b4ecca633e7d70290c.tar.bz2 rneovim-34f008e2472425ff89cd58b4ecca633e7d70290c.zip |
vim-patch:3afc9f2556fa
runtime(cmake): sync runtime files with upstream (vim/vim#13597)
https://github.com/vim/vim/commit/3afc9f2556faf2574d7950d879f2bf61612f3367
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/cmake.vim | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim index af27c0d49b..c1aa3bff86 100644 --- a/runtime/indent/cmake.vim +++ b/runtime/indent/cmake.vim @@ -3,9 +3,9 @@ " Author: Andy Cedilnik <andy.cedilnik@kitware.com> " Maintainer: Dimitri Merejkowsky <d.merej@gmail.com> " Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> -" Last Change: 2022 Apr 06 +" Last Change: 2023 Dec 12 " -" Licence: The CMake license applies to this file. See +" License: The CMake license applies to this file. See " https://cmake.org/licensing " This implies that distribution with Vim is allowed @@ -55,32 +55,41 @@ fun! CMakeGetIndent(lnum) let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier . \ '\s*(' . cmake_regex_arguments . \ '\(' . cmake_regex_comment . '\)\?$' - let cmake_indent_close_regex = '^' . cmake_regex_arguments . \ ')\s*' . \ '\(' . cmake_regex_comment . '\)\?$' - let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*(' - let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*(' + let cmake_closing_parens_line = '^\s*\()\+\)\s*$' - " Add - if previous_line =~? cmake_indent_comment_line " Handle comments - let ind = ind - else - if previous_line =~? cmake_indent_begin_regex - let ind = ind + shiftwidth() + let cmake_indent_begin_regex = '^\s*\(BLOCK\|IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*(' + let cmake_indent_end_regex = '^\s*\(ENDBLOCK\|ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*(' + + if this_line =~? cmake_closing_parens_line + if previous_line !~? cmake_indent_open_regex + let ind = ind - shiftwidth() endif - if previous_line =~? cmake_indent_open_regex - let ind = ind + shiftwidth() + else + " Add + if previous_line =~? cmake_indent_comment_line " Handle comments + let ind = ind + else + if previous_line =~? cmake_indent_begin_regex + let ind = ind + shiftwidth() + endif + if previous_line =~? cmake_indent_open_regex + let ind = ind + shiftwidth() + endif endif - endif - " Subtract - if this_line =~? cmake_indent_end_regex - let ind = ind - shiftwidth() - endif - if previous_line =~? cmake_indent_close_regex - let ind = ind - shiftwidth() + " Subtract + if this_line =~? cmake_indent_end_regex + let ind = ind - shiftwidth() + endif + if previous_line !~? cmake_closing_parens_line + if previous_line =~? cmake_indent_close_regex + let ind = ind - shiftwidth() + endif + endif endif return ind |