variables.vim 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. "=============================================================================
  2. " FILE: variables.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#variables#get_frequencies() abort "{{{
  28. if !exists('s:filetype_frequencies')
  29. let s:filetype_frequencies = {}
  30. endif
  31. let filetype = neocomplete#get_context_filetype()
  32. if !has_key(s:filetype_frequencies, filetype)
  33. let s:filetype_frequencies[filetype] = {}
  34. endif
  35. let frequencies = s:filetype_frequencies[filetype]
  36. return frequencies
  37. endfunction"}}}
  38. function! neocomplete#variables#get_sources() abort "{{{
  39. if !exists('s:sources')
  40. let s:sources = {}
  41. endif
  42. return s:sources
  43. endfunction"}}}
  44. function! neocomplete#variables#get_source(name) abort "{{{
  45. if !exists('s:sources')
  46. let s:sources = {}
  47. endif
  48. return get(s:sources, a:name, {})
  49. endfunction"}}}
  50. function! neocomplete#variables#get_filters() abort "{{{
  51. if !exists('s:filters')
  52. let s:filters = {}
  53. endif
  54. return s:filters
  55. endfunction"}}}
  56. let &cpo = s:save_cpo
  57. unlet s:save_cpo
  58. " vim: foldmethod=marker