indent.vim 821 B

123456789101112131415161718192021222324252627282930313233
  1. " Vim support file to switch on loading indent files for file types
  2. "
  3. " Maintainer: Bram Moolenaar <Bram@vim.org>
  4. " Last Change: 2008 Feb 22
  5. if exists("did_indent_on")
  6. finish
  7. endif
  8. let did_indent_on = 1
  9. augroup filetypeindent
  10. au FileType * call s:LoadIndent()
  11. func! s:LoadIndent()
  12. if exists("b:undo_indent")
  13. exe b:undo_indent
  14. unlet! b:undo_indent b:did_indent
  15. endif
  16. let s = expand("<amatch>")
  17. if s != ""
  18. if exists("b:did_indent")
  19. unlet b:did_indent
  20. endif
  21. " When there is a dot it is used to separate filetype names. Thus for
  22. " "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim".
  23. for name in split(s, '\.')
  24. exe 'runtime! indent/' . name . '.vim'
  25. exe 'runtime! indent/' . name . '.lua'
  26. endfor
  27. endif
  28. endfunc
  29. augroup END