| Server IP : 127.0.1.1 / Your IP : 216.73.216.152 Web Server : Apache/2.4.52 (Ubuntu) System : Linux bahcrestlinepropertiesllc 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/2792866/cwd/usr/share/vim/vim82/indent/ |
Upload File : |
" Vim indent file
" Language: Objective-C
" Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com>
" Last Change: 2004 May 16
"
" 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+=<:>
" 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