indent.vim 767 B

1234567891011121314151617181920212223242526272829303132
  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. endfor
  26. endif
  27. endfunc
  28. augroup END