" vim: set sw=4 sts=4: " " Language: Informix 4GL (fgl) indent file " Maintainer: Fernando Ortiz (fortiz (at) gmail (dot) com " Last Change: February 11, 2005 " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetFglIndent() " keywords that will trigger auto indent setlocal indentkeys+==~if,=~case,=~while,=~menu,=~construct,=~display,=~input,=~for,=~foreach,=~else " Only define the function once. if exists("*GetFglIndent") finish endif function GetFglIndent() " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) " Hit the start of the file, use zero indent. if lnum == 0 return 0 endif " Add a 'shiftwidth' after: case, construct, display array, for, foreach " function, if, input, menu, prompt " Also before, after, on, command " Skip if the line also contains the closure for the above let ind = indent(lnum) let line = getline(lnum) if line =~ '^\s*\c\(case\|construct\|display array\|for\|foreach\|function\|if\|input\|menu\|prompt\|else\|while\)\>' \ || line =~ '^\s*\c\(before\|after\|on key\|command\)' let ind = ind + &sw endif " Subtract a 'shiftwidth' on a else or end let line = getline(v:lnum) if line =~ '^\s*\c\(else\|end\)\>' let ind = ind - &sw endif return ind endfunction