Files
neovim/runtime/indent/objc.vim
zeertzjq ab20681c52 vim-patch:62d8f3d: runtime: Revert several "mark invalid contact addresses" commits (#37192)
This reverts commits:
- 6b652a785033fd4164e049492a7327c1ed7c3e5f
- 2f689d5abde0ccddca9e20d8c93a0299bd054e32
- a025a46d4169587145fb54f04af349cd05cb6122

Several email addresses that are known to be valid caused bounces
due to an issue with my email setup. The previous commits incorrectly
marked these addresses as invalid. So revert the whole thing again.

62d8f3dab5

N/A patch:
vim-patch:2f689d5: runtime: mark more invalid email addresses

Co-authored-by: Christian Brabandt <cb@256bit.org>
2026-01-02 06:53:44 +08:00

80 lines
1.6 KiB
VimL

" Vim indent file
" Language: Objective-C
" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
" Last Change: 2022 Apr 06
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal cindent
" Set the function to do the work.
setlocal indentexpr=GetObjCIndent()
" To make a colon (:) suggest an indentation other than a goto/switch label,
setlocal indentkeys-=:
setlocal indentkeys+=<:>
let b:undo_indent = "setl cin< inde< indk<"
" Only define the function once.
if exists("*GetObjCIndent")
finish
endif
function s:GetWidth(line, regexp)
let end = matchend(a:line, a:regexp)
let width = 0
let i = 0
while i < end
if a:line[i] != "\t"
let width = width + 1
else
let width = width + &ts - (width % &ts)
endif
let i = i + 1
endwhile
return width
endfunction
function s:LeadingWhiteSpace(line)
let end = strlen(a:line)
let width = 0
let i = 0
while i < end
let char = a:line[i]
if char != " " && char != "\t"
break
endif
if char != "\t"
let width = width + 1
else
let width = width + &ts - (width % &ts)
endif
let i = i + 1
endwhile
return width
endfunction
function GetObjCIndent()
let theIndent = cindent(v:lnum)
let prev_line = getline(v:lnum - 1)
let cur_line = getline(v:lnum)
if prev_line !~# ":" || cur_line !~# ":"
return theIndent
endif
if prev_line !~# ";"
let prev_colon_pos = s:GetWidth(prev_line, ":")
let delta = s:GetWidth(cur_line, ":") - s:LeadingWhiteSpace(cur_line)
let theIndent = prev_colon_pos - delta
endif
return theIndent
endfunction