vim

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

editorconfig.vim (2008B)


      1 " autoload/editorconfig.vim: EditorConfig native Vim script plugin
      2 " Copyright (c) 2011-2019 EditorConfig Team
      3 " All rights reserved.
      4 "
      5 " Redistribution and use in source and binary forms, with or without
      6 " modification, are permitted provided that the following conditions are met:
      7 "
      8 " 1. Redistributions of source code must retain the above copyright notice,
      9 "    this list of conditions and the following disclaimer.
     10 " 2. Redistributions in binary form must reproduce the above copyright notice,
     11 "    this list of conditions and the following disclaimer in the documentation
     12 "    and/or other materials provided with the distribution.
     13 "
     14 " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     15 " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     16 " IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     17 " ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
     18 " LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     19 " CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     20 " SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     21 " INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     22 " CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     23 " ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     24 " POSSIBILITY OF SUCH DAMAGE.
     25 "
     26 
     27 if v:version < 700
     28     finish
     29 endif
     30 
     31 let s:saved_cpo = &cpo
     32 set cpo&vim
     33 
     34 " {{{1 variables
     35 let s:hook_list = []
     36 
     37 function! editorconfig#AddNewHook(func) " {{{1
     38     " Add a new hook
     39 
     40     call add(s:hook_list, a:func)
     41 endfunction
     42 
     43 function! editorconfig#ApplyHooks(config) abort " {{{1
     44     " apply hooks
     45 
     46     for Hook in s:hook_list
     47         let l:hook_ret = Hook(a:config)
     48 
     49         if type(l:hook_ret) != type(0) && l:hook_ret != 0
     50             " TODO print some debug info here
     51         endif
     52     endfor
     53 endfunction
     54 
     55 " }}}
     56 
     57 let &cpo = s:saved_cpo
     58 unlet! s:saved_cpo
     59 
     60 " vim: fdm=marker fdc=3