vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

indent.vim (820B)


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