1 " PostScript indent file
3 " Maintainer: Mike Williams <mrw@netcomuk.co.uk>
4 " Last Change: 2nd July 2001
7 " Only load this indent file when no other was loaded.
8 if exists("b:did_indent")
13 setlocal indentexpr=PostscrIndentGet(v:lnum)
14 setlocal indentkeys+=0],0=>>,0=%%,0=end,0=restore,0=grestore indentkeys-=:,0#,e
16 " Catch multiple instantiations
17 if exists("*PostscrIndentGet")
21 function! PostscrIndentGet(lnum)
22 " Find a non-empty non-comment line above the current line.
23 " Note: ignores DSC comments as well!
26 let lnum = prevnonblank(lnum)
27 if getline(lnum) !~ '^\s*%.*$'
33 " Hit the start of the file, use user indent.
38 " Start with the indent of the previous line
39 let ind = indent(lnum)
40 let pline = getline(lnum)
42 " Indent for dicts, arrays, and saves with possible trailing comment
43 if pline =~ '\(begin\|<<\|g\=save\|{\|[\)\s*\(%.*\)\=$'
47 " Remove indent for popped dicts, and restores.
48 if pline =~ '\(end\|g\=restore\)\s*$'
51 " Else handle immediate dedents of dicts, restores, and arrays.
52 elseif getline(a:lnum) =~ '\(end\|>>\|g\=restore\|}\|]\)'
55 " Else handle DSC comments - always start of line.
56 elseif getline(a:lnum) =~ '^\s*%%'
60 " For now catch excessive left indents if they occur.