xf86conf.vim 786 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. " Vim indent file
  2. " Language: XFree86 Configuration File
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  5. " Last Change: 2022 April 25
  6. if exists("b:did_indent")
  7. finish
  8. endif
  9. let b:did_indent = 1
  10. setlocal indentexpr=GetXF86ConfIndent()
  11. setlocal indentkeys=!^F,o,O,=End
  12. setlocal nosmartindent
  13. let b:undo_indent = "setl inde< indk< si<"
  14. if exists("*GetXF86ConfIndent")
  15. finish
  16. endif
  17. function GetXF86ConfIndent()
  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*\(Sub\)\=Section\>'
  24. let ind = ind + shiftwidth()
  25. endif
  26. if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>'
  27. let ind = ind - shiftwidth()
  28. endif
  29. return ind
  30. endfunction