eterm.vim 743 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. " Vim indent file
  2. " Language: Eterm configuration file
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  5. " Last Change: 24 Sep 2021
  6. if exists("b:did_indent")
  7. finish
  8. endif
  9. let b:did_indent = 1
  10. setlocal indentexpr=GetEtermIndent()
  11. setlocal indentkeys=!^F,o,O,=end
  12. setlocal nosmartindent
  13. let b:undo_indent = "setl inde< indk< si<"
  14. if exists("*GetEtermIndent")
  15. finish
  16. endif
  17. function GetEtermIndent()
  18. let lnum = prevnonblank(v:lnum - 1)
  19. if lnum == 0
  20. return 0
  21. endif
  22. let ind = indent(lnum)
  23. if getline(lnum) =~ '^\s*begin\>'
  24. let ind = ind + shiftwidth()
  25. endif
  26. if getline(v:lnum) =~ '^\s*end\>'
  27. let ind = ind - shiftwidth()
  28. endif
  29. return ind
  30. endfunction