Server IP : 85.214.239.14 / Your IP : 18.118.154.250 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 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 : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/usr/share/vim/vim90/indent/ |
Upload File : |
" Vim indent file " Language: nginx.conf " Maintainer: Chris Aumann <me@chr4.org> " Last Change: 2022 Dec 01 " Only load this indent file when no other was loaded. if exists('b:did_indent') finish endif let b:did_indent = 1 setlocal indentexpr=GetNginxIndent() setlocal indentkeys=0{,0},0#,!^F,o,O let b:undo_indent = 'setl inde< indk<' " Only define the function once. if exists('*GetNginxIndent') finish endif function GetNginxIndent() abort let plnum = s:PrevNotAsBlank(v:lnum - 1) " Hit the start of the file, use zero indent. if plnum == 0 return 0 endif let ind = indent(plnum) " Add a 'shiftwidth' after '{' if s:AsEndWith(getline(plnum), '{') let ind = ind + shiftwidth() end " Subtract a 'shiftwidth' on '}' " This is the part that requires 'indentkeys'. if getline(v:lnum) =~ '^\s*}' let ind = ind - shiftwidth() endif let pplnum = s:PrevNotAsBlank(plnum - 1) if s:IsLineContinuation(plnum) if !s:IsLineContinuation(pplnum) let ind = ind + shiftwidth() end else if s:IsLineContinuation(pplnum) let ind = ind - shiftwidth() end endif return ind endfunction " Find the first line at or above {lnum} that is non-blank and not a comment. function s:PrevNotAsBlank(lnum) abort let lnum = prevnonblank(a:lnum) while lnum > 0 if getline(lnum) !~ '^\s*#' break endif let lnum = prevnonblank(lnum - 1) endwhile return lnum endfunction " Check whether {line} ends with {pat}, ignoring trailing comments. function s:AsEndWith(line, pat) abort return a:line =~ a:pat . '\m\s*\%(#.*\)\?$' endfunction function s:IsLineContinuation(lnum) abort return a:lnum > 0 && !s:AsEndWith(getline(a:lnum), '[;{}]') endfunction