custom.vim 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "=============================================================================
  2. " FILE: custom.vim
  3. " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
  4. " License: MIT license {{{
  5. " Permission is hereby granted, free of charge, to any person obtaining
  6. " a copy of this software and associated documentation files (the
  7. " "Software"), to deal in the Software without restriction, including
  8. " without limitation the rights to use, copy, modify, merge, publish,
  9. " distribute, sublicense, and/or sell copies of the Software, and to
  10. " permit persons to whom the Software is furnished to do so, subject to
  11. " the following conditions:
  12. "
  13. " The above copyright notice and this permission notice shall be included
  14. " in all copies or substantial portions of the Software.
  15. "
  16. " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  19. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  20. " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21. " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22. " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. " }}}
  24. "=============================================================================
  25. let s:save_cpo = &cpo
  26. set cpo&vim
  27. function! neocomplete#custom#get() abort "{{{
  28. if !exists('s:custom')
  29. let s:custom = {}
  30. let s:custom.sources = {}
  31. let s:custom.sources._ = {}
  32. endif
  33. return s:custom
  34. endfunction"}}}
  35. function! neocomplete#custom#source(source_name, option_name, value) abort "{{{
  36. let custom_sources = neocomplete#custom#get().sources
  37. for key in split(a:source_name, '\s*,\s*')
  38. if !has_key(custom_sources, key)
  39. let custom_sources[key] = {}
  40. endif
  41. let custom_sources[key][a:option_name] = a:value
  42. endfor
  43. endfunction"}}}
  44. let &cpo = s:save_cpo
  45. unlet s:save_cpo
  46. " vim: foldmethod=marker