neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

indent.vim (912B)


      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  func! s:LoadIndent()
     15    if exists("b:undo_indent")
     16      exe b:undo_indent
     17      unlet! b:undo_indent b:did_indent
     18    endif
     19    let s = expand("<amatch>")
     20    if s != ""
     21      if exists("b:did_indent")
     22 unlet b:did_indent
     23      endif
     24 
     25      " When there is a dot it is used to separate filetype names.  Thus for
     26      " "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim".
     27      for name in split(s, '\.')
     28        " XXX: "[.]" in the pattern makes it a wildcard on Windows
     29        exe $'runtime! indent/{name}[.]{{vim,lua}}'
     30      endfor
     31    endif
     32  endfunc
     33 augroup END