mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 06:05:06 -07:00
a98a6996c2
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7 Excluding: Amiga icons (*.info, icons/) doc/hangulin.txt tutor/ spell/ lang/ (only used for menu translations) macros/maze/, macros/hanoi/, macros/life/, macros/urm/ These were used to test vi compatibility. termcap "Demonstration of a termcap file (for the Amiga and Archimedes)" Helped-by: Rich Wareham <rjw57@cam.ac.uk> Helped-by: John <john.schmidt.h@gmail.com> Helped-by: Yann <yann@yann-salaun.com> Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com> Helped-by: drasill <github@tof2k.com> Helped-by: Tae Sandoval Murgan <taecilla@gmail.com> Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>
69 lines
1.6 KiB
VimL
69 lines
1.6 KiB
VimL
" PostScript indent file
|
|
" Language: PostScript
|
|
" Maintainer: Mike Williams <mrw@netcomuk.co.uk>
|
|
" Last Change: 2nd July 2001
|
|
"
|
|
|
|
" Only load this indent file when no other was loaded.
|
|
if exists("b:did_indent")
|
|
finish
|
|
endif
|
|
let b:did_indent = 1
|
|
|
|
setlocal indentexpr=PostscrIndentGet(v:lnum)
|
|
setlocal indentkeys+=0],0=>>,0=%%,0=end,0=restore,0=grestore indentkeys-=:,0#,e
|
|
|
|
" Catch multiple instantiations
|
|
if exists("*PostscrIndentGet")
|
|
finish
|
|
endif
|
|
|
|
function! PostscrIndentGet(lnum)
|
|
" Find a non-empty non-comment line above the current line.
|
|
" Note: ignores DSC comments as well!
|
|
let lnum = a:lnum - 1
|
|
while lnum != 0
|
|
let lnum = prevnonblank(lnum)
|
|
if getline(lnum) !~ '^\s*%.*$'
|
|
break
|
|
endif
|
|
let lnum = lnum - 1
|
|
endwhile
|
|
|
|
" Hit the start of the file, use user indent.
|
|
if lnum == 0
|
|
return -1
|
|
endif
|
|
|
|
" Start with the indent of the previous line
|
|
let ind = indent(lnum)
|
|
let pline = getline(lnum)
|
|
|
|
" Indent for dicts, arrays, and saves with possible trailing comment
|
|
if pline =~ '\(begin\|<<\|g\=save\|{\|[\)\s*\(%.*\)\=$'
|
|
let ind = ind + &sw
|
|
endif
|
|
|
|
" Remove indent for popped dicts, and restores.
|
|
if pline =~ '\(end\|g\=restore\)\s*$'
|
|
let ind = ind - &sw
|
|
|
|
" Else handle immediate dedents of dicts, restores, and arrays.
|
|
elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)'
|
|
let ind = ind - &sw
|
|
|
|
" Else handle DSC comments - always start of line.
|
|
elseif getline(a:lnum) =~ '^\s*%%'
|
|
let ind = 0
|
|
endif
|
|
|
|
" For now catch excessive left indents if they occur.
|
|
if ind < 0
|
|
let ind = -1
|
|
endif
|
|
|
|
return ind
|
|
endfunction
|
|
|
|
" vim:sw=2
|