vim-patch:partial:63f32603789d (#18916)

Update runtime files
https://github.com/vim/vim/commit/63f32603789d1a27c559fc440325955fd0b8b500

skip translations
skip user manual rewrite
This commit is contained in:
Christian Clason
2022-06-10 08:40:32 +02:00
committed by GitHub
parent 58323b1fe2
commit 6eaf10502c
9 changed files with 288 additions and 138 deletions
+12 -10
View File
@@ -3,13 +3,10 @@
" Maintainer: Nick Jensen <nickspoon@gmail.com>
" Former Maintainers: Aquila Deus
" Johannes Zellner <johannes@zellner.org>
" Last Change: 2018-11-21
" Filenames: *.cs
" Last Change: 2020-03-26
" License: Vim (see :h license)
" Repository: https://github.com/nickspoons/vim-cs
"
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
finish
endif
@@ -22,19 +19,23 @@ set cpoptions&vim
setlocal indentexpr=GetCSIndent(v:lnum)
function! s:IsCompilerDirective(line)
return a:line =~? '^\s*#'
" Exclude #region and #endregion - these should be indented normally
return a:line =~# '^\s*#' && !s:IsRegionDirective(a:line)
endf
function! s:IsRegionDirective(line)
return a:line =~# '^\s*#\s*region' || a:line =~# '^\s*#\s*endregion'
endf
function! s:IsAttributeLine(line)
return a:line =~? '^\s*\[[A-Za-z]' && a:line =~? '\]$'
return a:line =~# '^\s*\[[A-Za-z]' && a:line =~# '\]$'
endf
function! s:FindPreviousNonCompilerDirectiveLine(start_lnum)
for delta in range(0, a:start_lnum)
let lnum = a:start_lnum - delta
let line = getline(lnum)
let is_directive = s:IsCompilerDirective(line)
if !is_directive
if !s:IsCompilerDirective(line) && !s:IsRegionDirective(line)
return lnum
endif
endfor
@@ -58,8 +59,9 @@ function! GetCSIndent(lnum) abort
let lnum = s:FindPreviousNonCompilerDirectiveLine(a:lnum - 1)
let previous_code_line = getline(lnum)
if s:IsAttributeLine(previous_code_line)
let ind = indent(lnum)
return ind
return indent(lnum)
elseif s:IsRegionDirective(this_line)
return cindent(lnum)
else
return cindent(a:lnum)
endif