framescript.vim 816 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. " Vim indent file
  2. " Language: FrameScript
  3. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  4. " Latest Revision: 2008-07-19
  5. if exists("b:did_indent")
  6. finish
  7. endif
  8. let b:did_indent = 1
  9. setlocal indentexpr=GetFrameScriptIndent()
  10. setlocal indentkeys=!^F,o,O,0=~Else,0=~EndIf,0=~EndLoop,0=~EndSub
  11. setlocal nosmartindent
  12. if exists("*GetFrameScriptIndent")
  13. finish
  14. endif
  15. function GetFrameScriptIndent()
  16. let lnum = prevnonblank(v:lnum - 1)
  17. if lnum == 0
  18. return 0
  19. endif
  20. if getline(v:lnum) =~ '^\s*\*'
  21. return cindent(v:lnum)
  22. endif
  23. let ind = indent(lnum)
  24. if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)'
  25. let ind = ind + shiftwidth()
  26. endif
  27. if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)'
  28. let ind = ind - shiftwidth()
  29. endif
  30. return ind
  31. endfunction