Permalink
Browse files

stuff

  • Loading branch information...
1 parent 99c689f commit cc2b0542350fae4464188f6f5f2b900cf0e2b453 Tammer Saleh committed Feb 18, 2012
Showing with 499 additions and 6,046 deletions.
  1. +82 −76 vim/bundle/neocomplcache/autoload/neocomplcache.vim
  2. +20 −23 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
  3. +48 −48 vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
  4. +1 −1 vim/bundle/neocomplcache/autoload/neocomplcache/sources/completefunc_complete.vim
  5. +2 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim
  6. +2 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim
  7. +22 −3 vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
  8. +4 −5 vim/bundle/neocomplcache/autoload/neocomplcache/sources/keyword_complete.vim
  9. +10 −10 vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
  10. +2 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
  11. +0 −797 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete.vim
  12. +0 −16 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/_.snip
  13. +0 −273 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/actionscript.snip
  14. +0 −23 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/apache.snip
  15. +0 −201 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/applescript.snip
  16. +0 −135 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/c.snip
  17. +0 −72 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/coffee.snip
  18. +0 −37 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/cpp.snip
  19. +0 −252 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/css.snip
  20. +0 −39 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/d.snip
  21. +0 −19 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/eruby.snip
  22. +0 −274 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/java.snip
  23. +0 −47 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/javascript.snip
  24. +0 −51 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/markdown.snip
  25. +0 −352 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/objc.snip
  26. +0 −76 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/perl.snip
  27. +0 −260 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/php.snip
  28. +0 −85 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/python.snip
  29. +0 −163 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/rails.snip
  30. +0 −44 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/ruby.snip
  31. +0 −59 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/sh.snip
  32. +0 −8 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/snippet.snip
  33. +0 −431 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/tex.snip
  34. +0 −67 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/vim.snip
  35. +0 −4 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/vimshell.snip
  36. +0 −235 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/xhtml.snip
  37. +2 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/syntax_complete.vim
  38. +2 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete.vim
  39. +6 −57 vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/helper.vim
  40. +1 −4 vim/bundle/neocomplcache/autoload/unite/sources/neocomplcache.vim
  41. +1 −2 vim/bundle/neocomplcache/autoload/unite/sources/snippet.vim
  42. +0 −1,153 vim/bundle/neocomplcache/doc/neocomplcache.jax
  43. +215 −367 vim/bundle/neocomplcache/doc/neocomplcache.txt
  44. +0 −42 vim/bundle/neocomplcache/ftplugin/snippet.vim
  45. +0 −61 vim/bundle/neocomplcache/indent/snippet.vim
  46. +30 −42 vim/bundle/neocomplcache/plugin/neocomplcache.vim
  47. +0 −77 vim/bundle/neocomplcache/syntax/snippet.vim
  48. +5 −2 vim/bundle/tcomment_vim/autoload/tcomment.vim
  49. +2 −2 vim/bundle/vim-fugitive/plugin/fugitive.vim
  50. +2 −2 vim/bundle/vim-ruby/indent/ruby.vim
  51. +37 −38 vim/update_bundles
  52. +3 −1 vim/vimrc
View
158 vim/bundle/neocomplcache/autoload/neocomplcache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: neocomplcache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 31 Jan 2012.
+" Last Modified: 10 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -22,7 +22,7 @@
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
-" Version: 6.2, for Vim 7.2
+" Version: 7.0, for Vim 7.2
"=============================================================================
let s:save_cpo = &cpo
@@ -46,11 +46,16 @@ function! neocomplcache#enable() "{{{
augroup neocomplcache "{{{
autocmd!
" Auto complete events
- autocmd CursorMovedI * call s:on_moved_i()
- autocmd CursorHoldI * call s:on_hold_i()
autocmd InsertLeave * call s:on_insert_leave()
augroup END "}}}
+ if g:neocomplcache_enable_cursor_hold_i
+ autocmd neocomplcache CursorHoldI * call neocomplcache#do_auto_complete()
+ else
+ autocmd neocomplcache InsertEnter * call s:on_insert_enter()
+ autocmd neocomplcache CursorMovedI * call neocomplcache#do_auto_complete()
+ endif
+
" Disable beep.
set vb t_vb=
@@ -61,7 +66,7 @@ function! neocomplcache#enable() "{{{
let s:ftplugin_sources = {}
let s:loaded_ftplugin_sources = {}
let s:complete_lock = {}
- let s:plugins_lock = {}
+ let s:sources_lock = {}
let s:auto_completion_length = {}
let s:cur_keyword_str = ''
let s:complete_words = []
@@ -77,15 +82,15 @@ function! neocomplcache#enable() "{{{
let s:skip_next_complete = 0
let s:is_prefetch = 0
let s:use_sources = {}
+ let s:update_time_save = &updatetime
"}}}
" Initialize sources table."{{{
" Search autoload.
for file in split(globpath(&runtimepath, 'autoload/neocomplcache/sources/*.vim'), '\n')
let source_name = fnamemodify(file, ':t:r')
if !has_key(s:plugin_sources, source_name)
- \ && (!has_key(g:neocomplcache_plugin_disable, source_name) ||
- \ g:neocomplcache_plugin_disable[source_name] == 0)
+ \ && neocomplcache#is_source_enabled(source_name)
let source = call('neocomplcache#sources#' . source_name . '#define', [])
if empty(source)
" Ignore.
@@ -361,53 +366,57 @@ function! neocomplcache#enable() "{{{
"}}}
" Initialize include filetype lists."{{{
- if !exists('g:neocomplcache_filetype_include_lists')
- let g:neocomplcache_filetype_include_lists = {}
+ if exists('g:neocomplcache_filetype_include_lists')
+ let g:neocomplcache_context_filetype_lists =
+ \ g:neocomplcache_filetype_include_lists
+ endif
+ if !exists('g:neocomplcache_context_filetype_lists')
+ let g:neocomplcache_context_filetype_lists = {}
endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'c,cpp', [
\ {'filetype' : 'masm', 'start' : '_*asm_*\s\+\h\w*', 'end' : '$'},
\ {'filetype' : 'masm', 'start' : '_*asm_*\s*\%(\n\s*\)\?{', 'end' : '}'},
\ {'filetype' : 'gas', 'start' : '_*asm_*\s*\%(_*volatile_*\s*\)\?(', 'end' : ');'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'd', [
\ {'filetype' : 'masm', 'start' : 'asm\s*\%(\n\s*\)\?{', 'end' : '}'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'perl6', [
\ {'filetype' : 'pir', 'start' : 'Q:PIR\s*{', 'end' : '}'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'vimshell', [
\ {'filetype' : 'vim', 'start' : 'vexe \([''"]\)', 'end' : '\\\@<!\1'},
\ {'filetype' : 'vim', 'start' : ' :\w*', 'end' : '\n'},
\ {'filetype' : 'vim', 'start' : ' vexe\s\+', 'end' : '\n'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'eruby', [
\ {'filetype' : 'ruby', 'start' : '<%[=#]\?', 'end' : '%>'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'vim', [
\ {'filetype' : 'python', 'start' : '^\s*python <<\s*\(\h\w*\)', 'end' : '^\1'},
\ {'filetype' : 'ruby', 'start' : '^\s*ruby <<\s*\(\h\w*\)', 'end' : '^\1'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'html,xhtml', [
\ {'filetype' : 'javascript', 'start' : '<script type="text/javascript">', 'end' : '</script>'},
\ {'filetype' : 'css', 'start' : '<style type="text/css">', 'end' : '</style>'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'python', [
\ {'filetype' : 'vim', 'start' : 'vim.command\s*(\([''"]\)', 'end' : '\\\@<!\1\s*)'},
\ {'filetype' : 'vim', 'start' : 'vim.eval\s*(\([''"]\)', 'end' : '\\\@<!\1\s*)'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'help', [
\ {'filetype' : 'vim', 'start' : '^>', 'end' : '^<'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
\ 'nyaos,int-nyaos', [
\ {'filetype' : 'lua', 'start' : '\<lua_e\s\+\(["'']\)', 'end' : '^\1'},
\])
@@ -514,7 +523,6 @@ function! neocomplcache#enable() "{{{
" Check if "vim" command is executable.
if neocomplcache#has_vimproc() && !executable('vim')
echoerr '"vim" command is not executable. Asynchronous caching is disabled.'
- echoerr 'Please install "vim" command. And add to $PATH.'
let s:exists_vimproc = 0
endif
@@ -600,18 +608,9 @@ function! neocomplcache#manual_complete(findstart, base)"{{{
let s:cur_keyword_str = a:base
let s:is_prefetch = 0
- if (v:version > 703 || v:version == 703 && has('patch319'))
- let dict = { 'words' : s:complete_words }
-
- if !g:neocomplcache_enable_auto_select
- " Note: This feature breaks register-.
- " let dict.refresh = 'always'
- endif
-
- return dict
- else
- return s:complete_words
- endif
+ return (v:version > 703 || v:version == 703 && has('patch418')) ?
+ \ { 'words' : s:complete_words, 'refresh' : 'always' } :
+ \ s:complete_words
endfunction"}}}
function! neocomplcache#sources_manual_complete(findstart, base)"{{{
@@ -761,7 +760,7 @@ function! neocomplcache#do_auto_complete()"{{{
let s:changedtick = b:changedtick
endfunction"}}}
-" Plugin helper."{{{
+" Source helper."{{{
function! neocomplcache#available_complfuncs()"{{{
return s:complfunc_sources
endfunction"}}}
@@ -791,9 +790,14 @@ function! neocomplcache#keyword_escape(cur_keyword_str)"{{{
endif"}}}
" Fuzzy completion.
- if len(keyword_escape) < 8 && g:neocomplcache_enable_fuzzy_completion
- let keyword_escape = substitute(keyword_escape, '\w',
- \ '\\%(\0\\|\U\0\E\\l*\\|\0\\w*\\W\\)', 'g')
+ if g:neocomplcache_enable_fuzzy_completion
+ if len(keyword_escape) < 8
+ let keyword_escape = keyword_escape[: 1] . substitute(keyword_escape[2:], '\w',
+ \ '\\%(\0\\|\U\0\E\\l*\\|\0\\w*\\W\\)', 'g')
+ elseif len(keyword_escape) < 20
+ let keyword_escape = keyword_escape[: 3] . substitute(keyword_escape[4:12], '\w',
+ \ '\\%(\0\\|\U\0\E\\l*\\|\0\\w*\\W\\)', 'g') . keyword_escape[13:]
+ endif
else
" Underbar completion."{{{
if g:neocomplcache_enable_underbar_completion
@@ -1014,8 +1018,8 @@ endfunction"}}}
function! neocomplcache#get_completion_length(plugin_name)"{{{
if neocomplcache#is_auto_complete() && has_key(s:auto_completion_length, bufnr('%'))
return s:auto_completion_length[bufnr('%')]
- elseif has_key(g:neocomplcache_plugin_completion_length, a:plugin_name)
- return g:neocomplcache_plugin_completion_length[a:plugin_name]
+ elseif has_key(g:neocomplcache_source_completion_length, a:plugin_name)
+ return g:neocomplcache_source_completion_length[a:plugin_name]
elseif has_key(s:ftplugin_sources, a:plugin_name)
\ || has_key(s:complfunc_sources, a:plugin_name)
return 0
@@ -1026,13 +1030,13 @@ function! neocomplcache#get_completion_length(plugin_name)"{{{
endif
endfunction"}}}
function! neocomplcache#set_completion_length(plugin_name, length)"{{{
- if !has_key(g:neocomplcache_plugin_completion_length, a:plugin_name)
- let g:neocomplcache_plugin_completion_length[a:plugin_name] = a:length
+ if !has_key(g:neocomplcache_source_completion_length, a:plugin_name)
+ let g:neocomplcache_source_completion_length[a:plugin_name] = a:length
endif
endfunction"}}}
function! neocomplcache#get_auto_completion_length(plugin_name)"{{{
- if has_key(g:neocomplcache_plugin_completion_length, a:plugin_name)
- return g:neocomplcache_plugin_completion_length[a:plugin_name]
+ if has_key(g:neocomplcache_source_completion_length, a:plugin_name)
+ return g:neocomplcache_source_completion_length[a:plugin_name]
elseif g:neocomplcache_enable_fuzzy_completion
return 1
else
@@ -1101,9 +1105,9 @@ function! neocomplcache#is_plugin_locked(plugin_name)"{{{
endif
let bufnr = bufnr('%')
- return has_key(s:plugins_lock, bufnr)
- \ && has_key(s:plugins_lock[bufnr], a:plugin_name)
- \ && s:plugins_lock[bufnr][a:plugin_name]
+ return has_key(s:sources_lock, bufnr)
+ \ && has_key(s:sources_lock[bufnr], a:source_name)
+ \ && s:sources_lock[bufnr][a:source_name]
endfunction"}}}
function! neocomplcache#is_auto_select()"{{{
return g:neocomplcache_enable_auto_select && !neocomplcache#is_eskk_enabled()
@@ -1124,7 +1128,7 @@ function! neocomplcache#is_win()"{{{
return has('win32') || has('win64')
endfunction"}}}
function! neocomplcache#is_source_enabled(plugin_name)"{{{
- return !get(g:neocomplcache_plugin_disable, a:plugin_name, 0)
+ return !get(g:neocomplcache_source_disable, a:plugin_name, 0)
endfunction"}}}
function! neocomplcache#exists_echodoc()"{{{
return exists('g:loaded_echodoc') && g:loaded_echodoc
@@ -1193,15 +1197,15 @@ function! neocomplcache#get_context_filetype(...)"{{{
return s:context_filetype
endfunction"}}}
-function! neocomplcache#get_plugin_rank(plugin_name)"{{{
- if has_key(g:neocomplcache_plugin_rank, a:plugin_name)
- return g:neocomplcache_plugin_rank[a:plugin_name]
+function! neocomplcache#get_source_rank(plugin_name)"{{{
+ if has_key(g:neocomplcache_source_rank, a:plugin_name)
+ return g:neocomplcache_source_rank[a:plugin_name]
elseif has_key(s:complfunc_sources, a:plugin_name)
return 10
elseif has_key(s:ftplugin_sources, a:plugin_name)
return 100
elseif has_key(s:plugin_sources, a:plugin_name)
- return neocomplcache#get_plugin_rank('keyword_complete')
+ return neocomplcache#get_source_rank('keyword_complete')
else
" unknown.
return 1
@@ -1230,9 +1234,7 @@ function! neocomplcache#get_complete_results(cur_text, ...)"{{{
let sources = filter(sources, 'v:key ==# "omni_complete"')
endif
if a:0 < 1
- call filter(sources,
- \ '!(has_key(g:neocomplcache_plugin_disable, v:key)
- \ && g:neocomplcache_plugin_disable[v:key])
+ call filter(sources, 'neocomplcache#is_source_enabled(v:key)
\ && !neocomplcache#is_plugin_locked(v:key)')
endif
@@ -1245,7 +1247,7 @@ function! neocomplcache#get_complete_results(cur_text, ...)"{{{
call neocomplcache#print_error(v:throwpoint)
call neocomplcache#print_error(v:exception)
call neocomplcache#print_error('Error occured in complfunc''s get_keyword_pos()!')
- call neocomplcache#print_error('Plugin name is ' . source_name)
+ call neocomplcache#print_error('Source name is ' . source_name)
return complete_results
endtry
@@ -1307,7 +1309,7 @@ function! neocomplcache#get_complete_words(complete_results, is_sort,
endfor
endif
- let base_rank = neocomplcache#get_plugin_rank(source_name)
+ let base_rank = neocomplcache#get_source_rank(source_name)
for keyword in result.complete_words
let word = keyword.word
@@ -1467,7 +1469,7 @@ function! s:set_complete_results_words(complete_results)"{{{
call neocomplcache#print_error(v:throwpoint)
call neocomplcache#print_error(v:exception)
call neocomplcache#print_error('Error occured in complfunc''s get_complete_words()!')
- call neocomplcache#print_error('Plugin name is ' . source_name)
+ call neocomplcache#print_error('Source name is ' . source_name)
return
endtry
@@ -1529,29 +1531,29 @@ function! neocomplcache#unlock(...)"{{{
let s:complete_lock[bufnr('%')] = 0
endfunction"}}}
-function! neocomplcache#lock_plugin(plugin_name)"{{{
+function! neocomplcache#lock_source(source_name)"{{{
if !neocomplcache#is_enabled()
call neocomplcache#print_warning('neocomplcache is disabled! This command is ignored.')
return
endif
- if !has_key(s:plugins_lock, bufnr('%'))
- let s:plugins_lock[bufnr('%')] = {}
+ if !has_key(s:sources_lock, bufnr('%'))
+ let s:sources_lock[bufnr('%')] = {}
endif
- let s:plugins_lock[bufnr('%')][a:plugin_name] = 1
+ let s:sources_lock[bufnr('%')][a:source_name] = 1
endfunction"}}}
-function! neocomplcache#unlock_plugin(plugin_name)"{{{
+function! neocomplcache#unlock_source(source_name)"{{{
if !neocomplcache#is_enabled()
call neocomplcache#print_warning('neocomplcache is disabled! This command is ignored.')
return
endif
- if !has_key(s:plugins_lock, bufnr('%'))
- let s:plugins_lock[bufnr('%')] = {}
+ if !has_key(s:sources_lock, bufnr('%'))
+ let s:sources_lock[bufnr('%')] = {}
endif
- let s:plugins_lock[bufnr('%')][a:plugin_name] = 0
+ let s:sources_lock[bufnr('%')][a:source_name] = 0
endfunction"}}}
function! s:display_neco(number)"{{{
let cmdheight_save = &cmdheight
@@ -1848,14 +1850,11 @@ endfunction"}}}
"}}}
" Event functions."{{{
-function! s:on_hold_i()"{{{
- if g:neocomplcache_enable_cursor_hold_i
- call neocomplcache#do_auto_complete()
- endif
-endfunction"}}}
-function! s:on_moved_i()"{{{
- if !g:neocomplcache_enable_cursor_hold_i
- call neocomplcache#do_auto_complete()
+function! s:on_insert_enter()"{{{
+ if &updatetime > g:neocomplcache_cursor_hold_i_time
+ " Change updatetime.
+ let s:update_time_save = &updatetime
+ let &updatetime = g:neocomplcache_cursor_hold_i_time
endif
endfunction"}}}
function! s:on_insert_leave()"{{{
@@ -1866,6 +1865,11 @@ function! s:on_insert_leave()"{{{
let s:is_text_mode = 0
let s:skip_next_complete = 0
let s:is_prefetch = 0
+
+ if g:neocomplcache_enable_cursor_hold_i && &updatetime < s:update_time_save
+ " Restore updatetime.
+ let &updatetime = s:update_time_save
+ endif
endfunction"}}}
function! s:remove_next_keyword(plugin_name, list)"{{{
let list = a:list
@@ -1948,7 +1952,9 @@ function! s:set_context_filetype()"{{{
if !source.loaded
" Initialize.
- call source.initialize()
+ if has_key(source, 'initialize')
+ call source.initialize()
+ endif
let source.loaded = 1
endif
@@ -1968,11 +1974,11 @@ function! s:get_context_filetype(filetype)"{{{
if neocomplcache#is_eskk_enabled()
let context_filetype = 'eskk'
let filetype = 'eskk'
- elseif has_key(g:neocomplcache_filetype_include_lists, filetype)
- \ && !empty(g:neocomplcache_filetype_include_lists[filetype])
+ elseif has_key(g:neocomplcache_context_filetype_lists, filetype)
+ \ && !empty(g:neocomplcache_context_filetype_lists[filetype])
let pos = [line('.'), col('.')]
- for include in g:neocomplcache_filetype_include_lists[filetype]
+ for include in g:neocomplcache_context_filetype_lists[filetype]
let start_backward = searchpos(include.start, 'bnW')
" Check start <= line <= end.
View
43 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: cache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 11 Nov 2011.
+" Last Modified: 04 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -36,28 +36,25 @@ function! neocomplcache#cache#check_cache(cache_dir, key, async_cache_dictionary
return
endif
- for cache in a:async_cache_dictionary[a:key]
- " Check cache name.
- if filereadable(cache.cachename)
- " Caching.
- let a:keyword_list_dictionary[a:key] = {}
-
- let keyword_list = []
- for cache in a:async_cache_dictionary[a:key]
- let keyword_list +=
- \ neocomplcache#cache#load_from_cache(a:cache_dir, cache.filename)
- endfor
-
- call neocomplcache#cache#list2index(
- \ keyword_list,
- \ a:keyword_list_dictionary[a:key],
- \ a:completion_length)
-
- " Delete from dictionary.
- call remove(a:async_cache_dictionary, a:key)
-
- return
- endif
+ for cache in filter(copy(a:async_cache_dictionary[a:key]),
+ \ 'filereadable(v:val.cachename)')
+ " Caching.
+ let a:keyword_list_dictionary[a:key] = {}
+
+ let keyword_list = []
+ for cache in a:async_cache_dictionary[a:key]
+ let keyword_list +=
+ \ neocomplcache#cache#load_from_cache(a:cache_dir, cache.filename)
+ endfor
+
+ call neocomplcache#cache#list2index(
+ \ keyword_list,
+ \ a:keyword_list_dictionary[a:key],
+ \ a:completion_length)
+
+ " Delete from dictionary.
+ call remove(a:async_cache_dictionary, a:key)
+ break
endfor
endfunction"}}}
function! neocomplcache#cache#load_from_cache(cache_dir, filename)"{{{
View
96 vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: buffer_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 27 Jan 2012.
+" Last Modified: 06 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -41,14 +41,14 @@ function! s:source.initialize()"{{{
augroup neocomplcache"{{{
" Caching events
autocmd InsertEnter * call s:check_source()
- autocmd CursorHold * call s:check_deleted_buffer()
+ autocmd CursorHold * call s:check_cache()
autocmd InsertLeave *
\ call neocomplcache#sources#buffer_complete#caching_current_line()
autocmd VimLeavePre * call s:save_all_cache()
augroup END"}}}
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
\ 'buffer_complete', 5)
" Create cache directory.
@@ -101,17 +101,13 @@ endfunction"}}}
function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
let keyword_list = []
- for src in s:get_sources_list()
- let keyword_cache = neocomplcache#dictionary_filter(
- \ s:buffer_sources[src].keyword_cache,
- \ a:cur_keyword_str, s:completion_length)
- if src == bufnr('%')
+ for [key, source] in s:get_sources_list()
+ let keyword_list += neocomplcache#dictionary_filter(
+ \ source.keyword_cache, a:cur_keyword_str, s:completion_length)
+ if key == bufnr('%')
+ let source.accessed_time = localtime()
call s:calc_frequency()
endif
-
- let keyword_list += filter(keyword_cache,
- \ "!has_key(v:val, 'bufnr') ||
- \ stridx(get(getbufline(v:val.bufnr, v:val.line), 0, ''), v:val.word) >= 0")
endfor
return keyword_list
@@ -182,7 +178,6 @@ function! s:caching_current_buffer(start, end, is_auto)"{{{
if a:is_auto
" Save line number.
let keywords[key][match_str].line = a:start
- let keywords[key][match_str].bufnr = bufnr('%')
endif
endif
if !has_key(frequencies, match_str)
@@ -262,11 +257,11 @@ function! s:get_sources_list()"{{{
let filetypes_dict[filetype] = 1
endfor
- for key in keys(s:buffer_sources)
- if has_key(filetypes_dict, s:buffer_sources[key].filetype)
+ for [key, source] in items(s:buffer_sources)
+ if has_key(filetypes_dict, source.filetype)
\ || bufnr('%') == key
\ || (bufname('%') ==# '[Command Line]' && bufnr('#') == key)
- call add(sources_list, key)
+ call add(sources_list, [key, source])
endif
endfor
@@ -293,7 +288,7 @@ function! s:initialize_source(srcname)"{{{
\ 'keyword_cache' : {}, 'frequencies' : {}, 'prev_frequencies' : {},
\ 'name' : filename, 'filetype' : ft, 'keyword_pattern' : keyword_pattern,
\ 'end_line' : len(buflines),
- \ 'check_sum' : len(join(buflines[:4], '\n')),
+ \ 'accessed_time' : localtime(),
\ 'path' : path, 'loaded_cache' : 0,
\ 'cache_name' : neocomplcache#cache#encode_name('buffer_cache', path),
\}
@@ -322,15 +317,6 @@ endfunction"}}}
function! s:check_changed_buffer(bufnumber)"{{{
let source = s:buffer_sources[a:bufnumber]
- if getbufvar(a:bufnumber, '&buftype') =~ 'nofile'
- " Check buffer changed.
- let check_sum = len(join(getbufline(a:bufnumber, 1, 5), '\n'))
- if check_sum != source.check_sum
- " Recaching.
- return 1
- endif
- endif
-
let ft = getbufvar(a:bufnumber, '&filetype')
if ft == ''
let ft = 'nothing'
@@ -360,40 +346,57 @@ function! s:check_source()"{{{
call s:word_caching(bufnumber)
endif
- if has_key(s:buffer_sources, bufnumber)
- \ && !s:buffer_sources[bufnumber].loaded_cache
- let source = s:buffer_sources[bufnumber]
+ if !has_key(s:buffer_sources, bufnumber)
+ return
+ endif
- if filereadable(source.cache_name)
- " Caching from cache.
- call neocomplcache#cache#list2index(
- \ neocomplcache#cache#load_from_cache('buffer_cache', source.path),
- \ source.keyword_cache,
- \ s:completion_length)
+ let source = s:buffer_sources[bufnumber]
+ if !s:buffer_sources[bufnumber].loaded_cache
+ \&& filereadable(source.cache_name)
+ " Caching from cache.
+ call neocomplcache#cache#list2index(
+ \ neocomplcache#cache#load_from_cache('buffer_cache', source.path),
+ \ source.keyword_cache, s:completion_length)
- let source.loaded_cache = 1
- endif
+ let source.loaded_cache = 1
endif
endfunction"}}}
-function! s:check_deleted_buffer()"{{{
- " Check deleted buffer.
- for key in keys(s:buffer_sources)
+function! s:check_cache()"{{{
+ let release_accessd_time = localtime() - g:neocomplcache_release_cache_time
+
+ for [key, source] in items(s:buffer_sources)
+ " Check deleted buffer and access time.
if !bufloaded(str2nr(key))
+ \ || source.accessed_time < release_accessd_time
+
" Save cache.
call s:save_cache(key)
" Remove item.
call remove(s:buffer_sources, key)
endif
endfor
+
+ let bufnumber = bufnr('%')
+ if !has_key(s:buffer_sources, bufnumber)
+ return
+ endif
+ let source = s:buffer_sources[bufnumber]
+
+ " Check current line caching.
+ for cache in values(source.keyword_cache)
+ call filter(cache, "!has_key(v:val, 'line')
+ \ || stridx(getline(v:val.line), v:val.word) >= 0")
+ endfor
endfunction"}}}
function! s:exists_current_source()"{{{
return has_key(s:buffer_sources, bufnr('%'))
endfunction"}}}
function! s:save_cache(srcname)"{{{
- if s:buffer_sources[a:srcname].end_line < 500
+ let source = s:buffer_sources[a:srcname]
+ if source.end_line < 500
return
endif
@@ -422,13 +425,9 @@ function! s:save_cache(srcname)"{{{
return
endif
- let cache = filter(neocomplcache#unpack_dictionary(
- \ s:buffer_sources[a:srcname].keyword_cache),
- \ "!has_key(v:val, 'bufnr') ||
- \ stridx(get(getbufline(v:val.bufnr, v:val.line), 0, ''), v:val.word) >= 0")
-
" Output buffer.
- call neocomplcache#cache#save_cache('buffer_cache', srcname, cache)
+ call neocomplcache#cache#save_cache('buffer_cache', srcname,
+ \ neocomplcache#unpack_dictionary(source.keyword_cache))
endfunction "}}}
function! s:save_all_cache()"{{{
try
@@ -498,7 +497,8 @@ function! s:output_keyword(name)"{{{
endif
" Output buffer.
- for keyword in neocomplcache#unpack_dictionary(s:buffer_sources[number].keyword_cache)
+ for keyword in neocomplcache#unpack_dictionary(
+ \ s:buffer_sources[number].keyword_cache)
silent put=string(keyword)
endfor
endfunction "}}}
View
2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/completefunc_complete.vim
@@ -34,7 +34,7 @@ let s:source = {
function! s:source.initialize()"{{{
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'completefunc_complete', 5)
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank, 'completefunc_complete', 5)
endfunction"}}}
function! s:source.finalize()"{{{
endfunction"}}}
View
4 vim/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: dictionary_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 27 Jan 2012.
+" Last Modified: 04 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -61,7 +61,7 @@ function! s:source.initialize()"{{{
" Set caching event.
autocmd neocomplcache FileType * call s:caching()
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
\ 'dictionary_complete', 4)
" Add command.
View
4 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: filename_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 05 Jan 2012.
+" Last Modified: 04 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -77,7 +77,7 @@ function! s:source.initialize()"{{{
"}}}
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
\ 'filename_complete', 10)
endfunction"}}}
function! s:source.finalize()"{{{
View
25 vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: include_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 05 Jan 2012.
+" Last Modified: 05 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -38,17 +38,19 @@ function! s:source.initialize()"{{{
" Initialize
let s:include_info = {}
let s:include_cache = {}
+ let s:cache_accessed_time = {}
let s:async_include_cache = {}
let s:cached_pattern = {}
let s:completion_length = neocomplcache#get_auto_completion_length('include_complete')
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'include_complete', 8)
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank, 'include_complete', 8)
if neocomplcache#has_vimproc()
augroup neocomplcache
" Caching events
autocmd BufWritePost * call s:check_buffer('', 0)
+ autocmd CursorHold * call s:check_cache()
augroup END
endif
@@ -128,6 +130,7 @@ function! s:source.get_keyword_list(cur_keyword_str)"{{{
\ 'include_cache', include, s:async_include_cache,
\ s:include_cache, s:completion_length)
if has_key(s:include_cache, include)
+ let s:cache_accessed_time[include] = localtime()
let keyword_list += neocomplcache#dictionary_filter(
\ s:include_cache[include], a:cur_keyword_str, s:completion_length)
endif
@@ -142,12 +145,17 @@ endfunction"}}}
function! neocomplcache#sources#include_complete#get_include_files(bufnumber)"{{{
if has_key(s:include_info, a:bufnumber)
- return s:include_info[a:bufnumber].include_files
+ return copy(s:include_info[a:bufnumber].include_files)
else
return []
endif
endfunction"}}}
+function! neocomplcache#sources#include_complete#get_include_tags(bufnumber)"{{{
+ return filter(map(neocomplcache#sources#include_complete#get_include_files(a:bufnumber),
+ \ "neocomplcache#cache#encode_name('tags_output', v:val)"), 'filereadable(v:val)')
+endfunction"}}}
+
" For Debug.
function! neocomplcache#sources#include_complete#get_current_include_files()"{{{
return s:get_buffer_include_files(bufnr('%'))
@@ -354,6 +362,17 @@ function! s:get_include_files(nestlevel, lines, filetype, pattern, path, expr)"{
return include_files
endfunction"}}}
+function! s:check_cache()"{{{
+ let release_accessd_time = localtime() - g:neocomplcache_release_cache_time
+
+ for key in keys(s:include_cache)
+ if has_key(s:cache_accessed_time, key)
+ \ && s:cache_accessed_time[key] < release_accessd_time
+ call remove(s:include_cache, key)
+ endif
+ endfor
+endfunction"}}}
+
function! s:initialize_include(filename, filetype)"{{{
" Initialize include list from tags.
return {
View
9 vim/bundle/neocomplcache/autoload/neocomplcache/sources/keyword_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: keyword_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 19 Sep 2011.
+" Last Modified: 04 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -34,7 +34,7 @@ let s:source = {
function! s:source.initialize()"{{{
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
\ 'keyword_complete', 5)
" Set completion length.
@@ -62,8 +62,7 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
" Get keyword list.
let cache_keyword_list = []
for [name, plugin] in items(neocomplcache#available_plugins())
- if (has_key(g:neocomplcache_plugin_disable, name)
- \ && g:neocomplcache_plugin_disable[name])
+ if !neocomplcache#is_source_enabled(name)
\ || len(a:cur_keyword_str) < neocomplcache#get_completion_length(name)
\ || neocomplcache#is_plugin_locked(name)
" Skip plugin.
@@ -80,7 +79,7 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
return []
endtry
- let rank = neocomplcache#get_plugin_rank(name)
+ let rank = neocomplcache#get_source_rank(name)
for keyword in list
let keyword.rank = rank
endfor
View
20 vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: member_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 25 Oct 2011.
+" Last Modified: 04 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -46,7 +46,7 @@ function! s:source.initialize()"{{{
augroup END"}}}
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
\ 'member_complete', 5)
" Set completion length.
@@ -106,7 +106,7 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
endif
return neocomplcache#keyword_filter(
- \ s:get_member_list(cur_text, var_name), a:cur_keyword_str)
+ \ copy(s:get_member_list(cur_text, var_name)), a:cur_keyword_str)
endfunction"}}}
function! neocomplcache#sources#member_complete#define()"{{{
@@ -173,10 +173,10 @@ endfunction"}}}
function! s:get_member_list(cur_text, var_name)"{{{
let keyword_list = []
- for src in s:get_sources_list()
- if has_key(s:member_sources[src].member_cache, a:var_name)
- let keyword_list += values(s:member_sources[src].member_cache[a:var_name])
- endif
+ for [key, source] in filter(s:get_sources_list(),
+ \ 'has_key(v:val[1].member_cache, a:var_name)')
+ let keyword_list +=
+ \ values(source.member_cache[a:var_name])
endfor
return keyword_list
@@ -191,11 +191,11 @@ function! s:get_sources_list()"{{{
let filetypes_dict[filetype] = 1
endfor
- for key in keys(s:member_sources)
- if has_key(filetypes_dict, s:member_sources[key].filetype)
+ for [key, source] in items(s:member_sources)
+ if has_key(filetypes_dict, source.filetype)
\ || bufnr('%') == key
\ || (bufname('%') ==# '[Command Line]' && bufnr('#') == key)
- call add(sources_list, key)
+ call add(sources_list, [key, source])
endif
endfor
View
4 vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: omni_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 19 Dec 2011.
+" Last Modified: 04 Feb 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -94,7 +94,7 @@ function! s:source.initialize()"{{{
"}}}
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank,
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
\ 'omni_complete', 300)
endfunction"}}}
function! s:source.finalize()"{{{
View
797 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete.vim
@@ -1,797 +0,0 @@
-"=============================================================================
-" FILE: snippets_complete.vim
-" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 15 Jan 2012.
-" License: MIT license {{{
-" Permission is hereby granted, free of charge, to any person obtaining
-" a copy of this software and associated documentation files (the
-" "Software"), to deal in the Software without restriction, including
-" without limitation the rights to use, copy, modify, merge, publish,
-" distribute, sublicense, and/or sell copies of the Software, and to
-" permit persons to whom the Software is furnished to do so, subject to
-" the following conditions:
-"
-" The above copyright notice and this permission notice shall be included
-" in all copies or substantial portions of the Software.
-"
-" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-" }}}
-"=============================================================================
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-let s:begin_snippet = 0
-let s:end_snippet = 0
-
-if !exists('s:snippets')
- let s:snippets = {}
-endif
-
-let s:source = {
- \ 'name' : 'snippets_complete',
- \ 'kind' : 'plugin',
- \}
-
-function! s:source.initialize()"{{{
- " Initialize.
- let s:snippets = {}
- let s:begin_snippet = 0
- let s:end_snippet = 0
- let s:snippet_holder_cnt = 1
-
- if !exists('g:neocomplcache_snippets_disable_runtime_snippets')
- let g:neocomplcache_snippets_disable_runtime_snippets = 0
- endif
-
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_plugin_rank, 'snippets_complete', 8)
-
- let s:snippets_dir = []
- let s:runtime_dir = split(globpath(&runtimepath,
- \ 'autoload/neocomplcache/sources/snippets_complete'), '\n')
-
- if !g:neocomplcache_snippets_disable_runtime_snippets
- " Set snippets dir.
- let s:snippets_dir += (exists('g:snippets_dir') ?
- \ split(g:snippets_dir, ',')
- \ : split(globpath(&runtimepath, 'snippets'), '\n'))
- \ + s:runtime_dir
- endif
-
- if exists('g:neocomplcache_snippets_dir')
- for dir in split(g:neocomplcache_snippets_dir, ',')
- let dir = neocomplcache#util#expand(dir)
- if !isdirectory(dir)
- call mkdir(dir, 'p')
- endif
- call add(s:snippets_dir, dir)
- endfor
- endif
- call map(s:snippets_dir, 'substitute(v:val, "[\\\\/]$", "", "")')
-
- augroup neocomplcache"{{{
- " Set caching event.
- autocmd FileType * call s:caching()
- " Recaching events
- autocmd BufWritePost *.snip,*.snippets call s:caching_snippets(expand('<afile>:t:r'))
- " Detect syntax file.
- autocmd BufNewFile,BufRead *.snip,*.snippets set filetype=snippet
- augroup END"}}}
-
- if has('conceal')
- " Supported conceal features.
- augroup neocomplcache
- autocmd BufNewFile,BufRead,ColorScheme *
- \ syn match neocomplcacheExpandSnippets
- \ '\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>\|\$\d\+' conceal cchar=$
- augroup END
- else
- augroup neocomplcache
- autocmd BufNewFile,BufRead,ColorScheme *
- \ syn match neocomplcacheExpandSnippets
- \ '\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>\|\$\d\+'
- augroup END
- endif
-
- hi def link NeoComplCacheExpandSnippets Special
-
- command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
- \ NeoComplCacheEditSnippets call s:edit_snippets(<q-args>, 0)
- command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
- \ NeoComplCacheEditRuntimeSnippets call s:edit_snippets(<q-args>, 1)
- command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
- \ NeoComplCacheCachingSnippets call s:caching_snippets(<q-args>)
-
- " Select mode mappings.
- if !exists('g:neocomplcache_disable_select_mode_mappings')
- snoremap <CR> a<BS>
- snoremap <BS> a<BS>
- snoremap <right> <ESC>a
- snoremap <left> <ESC>bi
- snoremap ' a<BS>'
- snoremap ` a<BS>`
- snoremap % a<BS>%
- snoremap U a<BS>U
- snoremap ^ a<BS>^
- snoremap \ a<BS>\
- snoremap <C-x> a<BS><c-x>
- endif
-
- " Caching _ snippets.
- call s:caching_snippets('_')
-
- " Initialize check.
- call s:caching()
-
- if neocomplcache#exists_echodoc()
- call echodoc#register('snippets_complete', s:doc_dict)
- endif
-endfunction"}}}
-
-function! s:source.finalize()"{{{
- delcommand NeoComplCacheEditSnippets
- delcommand NeoComplCacheEditRuntimeSnippets
- delcommand NeoComplCacheCachingSnippets
-
- hi clear NeoComplCacheExpandSnippets
-
- if neocomplcache#exists_echodoc()
- call echodoc#unregister('snippets_complete')
- endif
-endfunction"}}}
-
-function! s:source.get_keyword_list(cur_keyword_str)"{{{
- if !has_key(s:snippets, '_')
- " Caching _ snippets.
- call s:caching_snippets('_')
- endif
- let snippets = values(s:snippets['_'])
-
- let filetype = neocomplcache#get_context_filetype()
- if !has_key(s:snippets, filetype)
- " Caching snippets.
- call s:caching_snippets(filetype)
- endif
- for source in neocomplcache#get_sources_list(s:snippets, filetype)
- let snippets += values(source)
- endfor
-
- return s:keyword_filter(neocomplcache#dup_filter(snippets), a:cur_keyword_str)
-endfunction"}}}
-
-function! neocomplcache#sources#snippets_complete#define()"{{{
- return s:source
-endfunction"}}}
-
-function! s:compare_words(i1, i2)
- return a:i1.menu - a:i2.menu
-endfunction
-
-" For echodoc."{{{
-let s:doc_dict = {
- \ 'name' : 'snippets_complete',
- \ 'rank' : 100,
- \ 'filetypes' : {},
- \ }
-function! s:doc_dict.search(cur_text)"{{{
- if mode() !=# 'i'
- return []
- endif
-
- let snippets = neocomplcache#sources#snippets_complete#get_snippets()
-
- let cur_word = s:get_cursor_keyword_snippet(snippets, a:cur_text)
- if cur_word == ''
- return []
- endif
-
- let snip = snippets[cur_word]
- let ret = []
- call add(ret, { 'text' : snip.word, 'highlight' : 'String' })
- call add(ret, { 'text' : ' ' })
- call add(ret, { 'text' : snip.menu, 'highlight' : 'Special' })
- call add(ret, { 'text' : ' ' })
- call add(ret, { 'text' : snip.snip})
-
- return ret
-endfunction"}}}
-"}}}
-
-function! s:keyword_filter(list, cur_keyword_str)"{{{
- let keyword_escape = neocomplcache#keyword_escape(a:cur_keyword_str)
-
- let prev_word = neocomplcache#get_prev_word(a:cur_keyword_str)
- " Keyword filter.
- let pattern = printf('v:val.word =~ %s && (!has_key(v:val, "prev_word") || v:val.prev_word == %s)',
- \string('^' . keyword_escape), string(prev_word))
-
- let list = filter(a:list, pattern)
-
- " Substitute abbr.
- let abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10)
- for snippet in list
- if snippet.snip =~ '\\\@<!`=.*\\\@<!`'
- let snippet.menu = s:eval_snippet(snippet.snip)
-
- if g:neocomplcache_max_keyword_width >= 0 &&
- \ len(snippet.menu) > g:neocomplcache_max_keyword_width
- let snippet.menu = printf(abbr_pattern, snippet.menu, snippet.menu[-8:])
- endif
- let snippet.menu = '`Snip` ' . snippet.menu
- endif
- endfor
-
- return list
-endfunction"}}}
-
-function! neocomplcache#sources#snippets_complete#expandable()"{{{
- let snippets = neocomplcache#sources#snippets_complete#get_snippets()
- let cur_text = neocomplcache#get_cur_text(1)
-
- let ret = 0
-
- if s:get_cursor_keyword_snippet(snippets, cur_text) != ''
- " Found snippet trigger.
- let ret += 1
- endif
-
- if search('\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>', 'nw') > 0
- " Found snippet placeholder.
- let ret += 2
- endif
-
- return ret
-endfunction"}}}
-
-function! s:caching()"{{{
- for filetype in neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype(1))
- if !has_key(s:snippets, filetype)
- call s:caching_snippets(filetype)
- endif
- endfor
-endfunction"}}}
-
-function! s:set_snippet_dict(snippet_pattern, snippet_dict, dup_check, snippets_file)"{{{
- if has_key(a:snippet_pattern, 'name')
- let pattern = s:set_snippet_pattern(a:snippet_pattern)
- let action_pattern = '^snippet\s\+' . a:snippet_pattern.name . '$'
- let a:snippet_dict[a:snippet_pattern.name] = pattern
- let a:dup_check[a:snippet_pattern.name] = 1
-
- if has_key(a:snippet_pattern, 'alias')
- for alias in a:snippet_pattern.alias
- let alias_pattern = copy(pattern)
- let alias_pattern.word = alias
-
- let abbr = (g:neocomplcache_max_keyword_width >= 0 &&
- \ len(alias) > g:neocomplcache_max_keyword_width) ?
- \ printf(abbr_pattern, alias, alias[-8:]) : alias
- let alias_pattern.abbr = abbr
- let alias_pattern.action__path = a:snippets_file
- let alias_pattern.action__pattern = action_pattern
- let alias_pattern.real_name = a:snippet_pattern.name
-
- let a:snippet_dict[alias] = alias_pattern
- let a:dup_check[alias] = 1
- endfor
- endif
-
- let snippet = a:snippet_dict[a:snippet_pattern.name]
- let snippet.action__path = a:snippets_file
- let snippet.action__pattern = action_pattern
- let snippet.real_name = a:snippet_pattern.name
- endif
-endfunction"}}}
-function! s:set_snippet_pattern(dict)"{{{
- let abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10)
-
- let word = substitute(a:dict.word, '\%(<\\n>\)\+$', '', '')
- let menu_pattern = a:dict.word =~ '\${\d\+\%(:.\{-}\)\?\\\@<!}' ? '<Snip> ' : '[Snip] '
-
- let abbr = has_key(a:dict, 'abbr')? a:dict.abbr :
- \substitute(a:dict.word, '\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>\|\$\d\+\|<\%(\\n\|\\t\)>\|\s\+', ' ', 'g')
- let abbr = (g:neocomplcache_max_keyword_width >= 0 && len(abbr) > g:neocomplcache_max_keyword_width)?
- \ printf(abbr_pattern, abbr, abbr[-8:]) : abbr
-
- let dict = {
- \ 'word' : a:dict.name, 'snip' : word, 'abbr' : a:dict.name,
- \ 'description' : word,
- \ 'menu' : menu_pattern . abbr, 'dup' : 1
- \}
- if has_key(a:dict, 'prev_word')
- let dict.prev_word = a:dict.prev_word
- endif
- return dict
-endfunction"}}}
-
-function! s:edit_snippets(filetype, isruntime)"{{{
- if a:filetype == ''
- let filetype = neocomplcache#get_context_filetype(1)
- else
- let filetype = a:filetype
- endif
-
- " Edit snippet file.
- if a:isruntime
- if empty(s:runtime_dir)
- return
- endif
-
- let filename = s:runtime_dir[0].'/'.filetype.'.snip'
- else
- if empty(s:snippets_dir)
- return
- endif
-
- let filename = s:snippets_dir[-1].'/'.filetype.'.snip'
- endif
-
- if filereadable(filename)
- edit `=filename`
- else
- enew
- setfiletype snippet
- saveas `=filename`
- endif
-endfunction"}}}
-
-function! s:caching_snippets(filetype)"{{{
- let filetype = a:filetype == '' ?
- \ &filetype : a:filetype
-
- let snippet = {}
- let snippets_files = split(globpath(join(s:snippets_dir, ','), filetype . '.snip*'), '\n')
- \ + split(globpath(join(s:snippets_dir, ','), filetype . '_*.snip*'), '\n')
- for snippets_file in snippets_files
- call s:load_snippets(snippet, snippets_file)
- endfor
-
- let s:snippets[filetype] = snippet
-endfunction"}}}
-
-function! s:load_snippets(snippet, snippets_file)"{{{
- let dup_check = {}
- let snippet_pattern = { 'word' : '' }
- let abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10)
-
- let linenr = 1
-
- for line in readfile(a:snippets_file)
- if line =~ '^\h\w*.*\s$'
- " Delete spaces.
- let line = substitute(line, '\s\+$', '', '')
- endif
-
- if line =~ '^include'
- " Include snippets.
- let snippet_file = matchstr(line, '^include\s\+\zs.*$')
- for snippets_file in split(globpath(join(s:snippets_dir, ','), snippet_file), '\n')
- call s:load_snippets(a:snippet, snippets_file)
- endfor
- elseif line =~ '^delete\s'
- let name = matchstr(line, '^delete\s\+\zs.*$')
- if name != '' && has_key(a:snippet, name)
- call filter(a:snippet, 'v:val.real_name !=# name')
- endif
- elseif line =~ '^snippet\s'
- if has_key(snippet_pattern, 'name')
- " Set previous snippet.
- call s:set_snippet_dict(snippet_pattern,
- \ a:snippet, dup_check, a:snippets_file)
- let snippet_pattern = { 'word' : '' }
- endif
-
- let snippet_pattern.name =
- \ substitute(matchstr(line, '^snippet\s\+\zs.*$'), '\s', '_', 'g')
-
- " Check for duplicated names.
- if has_key(dup_check, snippet_pattern.name)
- call neocomplcache#print_error('Warning: ' . a:snippets_file . ':'
- \ . linenr . ': duplicated snippet name `'
- \ . snippet_pattern.name . '`')
- call neocomplcache#print_error('Please delete this snippet name before.')
- endif
- elseif has_key(snippet_pattern, 'name')
- " Only in snippets.
- if line =~ '^abbr\s'
- let snippet_pattern.abbr = matchstr(line, '^abbr\s\+\zs.*$')
- elseif line =~ '^alias\s'
- let snippet_pattern.alias = split(matchstr(line,
- \ '^alias\s\+\zs.*$'), '[,[:space:]]\+')
- elseif line =~ '^prev_word\s'
- let snippet_pattern.prev_word = matchstr(line,
- \ '^prev_word\s\+[''"]\zs.*\ze[''"]$')
- elseif line =~ '^\s'
- if snippet_pattern.word == ''
- let snippet_pattern.word = matchstr(line, '^\s\+\zs.*$')
- elseif line =~ '^\t'
- let line = substitute(line, '^\s', '', '')
- let snippet_pattern.word .= '<\n>' .
- \ substitute(line, '^\t\+', repeat('<\\t>',
- \ matchend(line, '^\t\+')), '')
- else
- let snippet_pattern.word .= '<\n>' . matchstr(line, '^\s\+\zs.*$')
- endif
- elseif line =~ '^$'
- " Blank line.
- let snippet_pattern.word .= '<\n>'
- endif
- endif
-
- let linenr += 1
- endfor
-
- " Set previous snippet.
- call s:set_snippet_dict(snippet_pattern,
- \ a:snippet, dup_check, a:snippets_file)
-
- return a:snippet
-endfunction"}}}
-
-function! s:get_cursor_keyword_snippet(snippets, cur_text)"{{{
- let cur_word = matchstr(a:cur_text, neocomplcache#get_keyword_pattern_end().'\|\h\w*\W\+$')
- if !has_key(a:snippets, cur_word)
- let cur_word = ''
- endif
-
- return cur_word
-endfunction"}}}
-function! s:get_cursor_snippet(snippets, cur_text)"{{{
- let cur_word = matchstr(a:cur_text, '\S\+$')
- while cur_word != '' && !has_key(a:snippets, cur_word)
- let cur_word = cur_word[1:]
- endwhile
-
- return cur_word
-endfunction"}}}
-function! s:snippets_force_expand(cur_text, col)"{{{
- let cur_word = s:get_cursor_snippet(neocomplcache#sources#snippets_complete#get_snippets(), a:cur_text)
-
- call neocomplcache#sources#snippets_complete#expand(a:cur_text, a:col, cur_word)
-endfunction"}}}
-function! s:snippets_expand_or_jump(cur_text, col)"{{{
- let cur_word = s:get_cursor_keyword_snippet(
- \ neocomplcache#sources#snippets_complete#get_snippets(), a:cur_text)
- if cur_word != ''
- " Found snippet trigger.
- call neocomplcache#sources#snippets_complete#expand(a:cur_text, a:col, cur_word)
- else
- call s:snippets_force_jump(a:cur_text, a:col)
- endif
-endfunction"}}}
-function! s:snippets_jump_or_expand(cur_text, col)"{{{
- let cur_word = s:get_cursor_keyword_snippet(
- \ neocomplcache#sources#snippets_complete#get_snippets(), a:cur_text)
- if search('\${\d\+\%(:.\{-}\)\?\\\@<!}\|\$<\d\+\%(:.\{-}\)\?\\\@<!>', 'nw') > 0
- " Found snippet placeholder.
- call s:snippets_force_jump(a:cur_text, a:col)
- else
- call neocomplcache#sources#snippets_complete#expand(a:cur_text, a:col, cur_word)
- endif
-endfunction"}}}
-function! neocomplcache#sources#snippets_complete#expand(cur_text, col, trigger_name)"{{{
- if a:trigger_name == ''
- let pos = getpos('.')
- let pos[2] = len(a:cur_text)+1
- call setpos('.', pos)
-
- if pos[2] < col('$')
- startinsert
- else
- startinsert!
- endif
-
- return
- endif
-
- let snippets = neocomplcache#sources#snippets_complete#get_snippets()
- let snippet = snippets[a:trigger_name]
- let cur_text = a:cur_text[: -1-len(a:trigger_name)]
-
- let snip_word = snippet.snip
- if snip_word =~ '\\\@<!`.*\\\@<!`'
- let snip_word = s:eval_snippet(snip_word)
- endif
- if snip_word =~ '\n'
- let snip_word = substitute(snip_word, '\n', '<\\n>', 'g')
- endif
-
- " Substitute escaped `.
- let snip_word = substitute(snip_word, '\\`', '`', 'g')
-
- " Insert snippets.
- let next_line = getline('.')[a:col-1 :]
- call setline(line('.'), cur_text . snip_word . next_line)
- let pos = getpos('.')
- let pos[2] = len(cur_text)+len(snip_word)+1
- call setpos('.', pos)
- let next_col = len(cur_text)+len(snip_word)+1
-
- if snip_word =~ '<\\t>'
- call s:expand_tabline()
- else
- call s:expand_newline()
- end
- if has('folding') && foldclosed(line('.'))
- " Open fold.
- silent! normal! zO
- endif
- if next_col < col('$')
- startinsert
- else
- startinsert!
- endif
-
- if snip_word =~ '\${\d\+\%(:.\{-}\)\?\\\@<!}'
- call s:snippets_force_jump(a:cur_text, a:col)
- endif
-
- let &l:iminsert = 0
- let &l:imsearch = 0
-endfunction"}}}
-function! s:expand_newline()"{{{
- let match = match(getline('.'), '<\\n>')
- let s:snippet_holder_cnt = 1
- let s:begin_snippet = line('.')
- let s:end_snippet = line('.')
-
- let formatoptions = &l:formatoptions
- setlocal formatoptions-=r
-
- while match >= 0
- let end = getline('.')[matchend(getline('.'), '<\\n>') :]
- " Substitute CR.
- silent! execute 's/<\\n>//' . (&gdefault ? 'g' : '')
-
- " Return.
- let pos = getpos('.')
- let pos[2] = match+1
- call setpos('.', pos)
- silent execute 'normal!'
- \ (match+1 >= col('$')? 'a' : 'i')."\<CR>"
-
- " Next match.
- let match = match(getline('.'), '<\\n>')
- let s:end_snippet += 1
- endwhile
-
- let &l:formatoptions = formatoptions
-endfunction"}}}
-function! s:expand_tabline()"{{{
- let tablines = split(getline('.'), '<\\n>')
-
- let indent = matchstr(tablines[0], '^\s\+')
- let line = line('.')
- call setline(line, tablines[0])
- for tabline in tablines[1:]
- if &expandtab
- let tabline = substitute(tabline, '<\\t>',
- \ repeat(' ', &softtabstop ? &softtabstop : &shiftwidth), 'g')
- else
- let tabline = substitute(tabline, '<\\t>', '\t', 'g')
- endif
-
- call append(line, indent . tabline)
- let line += 1
- endfor
-
- let s:snippet_holder_cnt = 1
- let s:begin_snippet = line('.')
- let s:end_snippet = line('.') + len(tablines) - 1
-endfunction"}}}
-function! s:snippets_force_jump(cur_text, col)"{{{
- if !s:search_snippet_range(s:begin_snippet, s:end_snippet)
- if s:snippet_holder_cnt != 0
- " Search placeholder 0.
- let s:snippet_holder_cnt = 0
- if s:search_snippet_range(s:begin_snippet, s:end_snippet)
- return 1
- endif
- endif
-
- " Not found.
- let s:begin_snippet = 1
- let s:end_snippet = 0
- let s:snippet_holder_cnt = 1
-
- return s:search_outof_range(a:col)
- endif
-
- return 0
-endfunction"}}}
-function! s:search_snippet_range(start, end)"{{{
- call s:substitute_marker(a:start, a:end)
-
- let pattern = '\${'.s:snippet_holder_cnt.'\%(:.\{-}\)\?\\\@<!}'
-
- let line = a:start
- for line in filter(range(a:start, a:end),
- \ 'getline(v:val) =~ pattern')
- call s:expand_placeholder(a:start, a:end,
- \ s:snippet_holder_cnt, line)
-
- " Next count.
- let s:snippet_holder_cnt += 1
- return 1
- endfor
-
- return 0
-endfunction"}}}
-function! s:search_outof_range(col)"{{{
- call s:substitute_marker(1, 0)
-
- let pattern = '\${\d\+\%(:.\{-}\)\?\\\@<!}'
- if search(pattern, 'w') > 0
- call s:expand_placeholder(line('.'), 0, '\d\+', line('.'))
- return 1
- endif
-
- let pos = getpos('.')
- if a:col == 1
- let pos[2] = 1
- call setpos('.', pos)
- startinsert
- elseif a:col == col('$')
- startinsert!
- else
- let pos[2] = a:col+1
- call setpos('.', pos)
- startinsert
- endif
-
- " Not found.
- return 0
-endfunction"}}}
-function! s:expand_placeholder(start, end, holder_cnt, line)"{{{
- let pattern = '\${'.a:holder_cnt.'\%(:.\{-}\)\?\\\@<!}'
- let current_line = getline(a:line)
- let match = match(current_line, pattern)
-
- let default_pattern = '\${'.a:holder_cnt.':\zs.\{-}\ze\\\@<!}'
- let default = substitute(
- \ matchstr(current_line, default_pattern), '\\\ze.', '', 'g')
- let default_len = len(default)
-
- let pos = getpos('.')
- let pos[1] = a:line
- let pos[2] = match+1
-
- let cnt = s:search_sync_placeholder(a:start, a:end, a:holder_cnt)
- if cnt > 0
- let pattern = '\${' . cnt . '\%(:.\{-}\)\?\\\@<!}'
- call setline(a:line, substitute(current_line, pattern,
- \ '\$<'.cnt.':'.escape(default, '\').'>', ''))
- let pos[2] += len('$<'.cnt.':')
- else
- " Substitute holder.
- call setline(a:line,
- \ substitute(current_line, pattern, escape(default, '\'), ''))
- endif
-
- call setpos('.', pos)
-
- if default_len > 0
- " Select default value.
- let len = default_len-1
- if &l:selection == "exclusive"
- let len += 1
- endif
-
- stopinsert
- execute "normal! v". repeat('l', len) . "\<C-g>"
- elseif pos[2] < col('$')
- startinsert
- else
- startinsert!
- endif
-endfunction"}}}
-function! s:search_sync_placeholder(start, end, number)"{{{
- if a:end == 0
- " Search in current buffer.
- let cnt = matchstr(getline(a:start),
- \ '\${\zs\d\+\ze\%(:.\{-}\)\?\\\@<!}')
- return search('\$'.cnt.'\d\@!', 'nw') > 0 ? cnt : 0
- endif
-
- let pattern = '\$'.a:number.'\d\@!'
- for line in filter(range(a:start, a:end),
- \ 'getline(v:val) =~ pattern')
- return s:snippet_holder_cnt
- endfor
-
- return 0
-endfunction"}}}
-function! s:substitute_marker(start, end)"{{{
- if s:snippet_holder_cnt > 1
- let cnt = s:snippet_holder_cnt-1
- let marker = '\$<'.cnt.'\%(:.\{-}\)\?\\\@<!>'
- let line = a:start
- while line <= a:end
- if getline(line) =~ marker
- let sub = escape(matchstr(getline(line), '\$<'.cnt.':\zs.\{-}\ze\\\@<!>'), '/\')
- silent! execute printf('%d,%ds/$%d\d\@!/%s/' . (&gdefault ? '' : 'g'),
- \a:start, a:end, cnt, sub)
- silent! execute line.'s/'.marker.'/'.sub.'/' . (&gdefault ? 'g' : '')
- break
- endif
-
- let line += 1
- endwhile
- elseif search('\$<\d\+\%(:.\{-}\)\?\\\@<!>', 'wb') > 0
- let sub = escape(matchstr(getline('.'), '\$<\d\+:\zs.\{-}\ze\\\@<!>'), '/\')
- let cnt = matchstr(getline('.'), '\$<\zs\d\+\ze\%(:.\{-}\)\?\\\@<!>')
- silent! execute printf('%%s/$%d\d\@!/%s/' . (&gdefault ? 'g' : ''), cnt, sub)
- silent! execute '%s/'.'\$<'.cnt.'\%(:.\{-}\)\?\\\@<!>'.'/'.sub.'/'
- \ . (&gdefault ? 'g' : '')
- endif
-endfunction"}}}
-function! s:trigger(function)"{{{
- let cur_text = neocomplcache#get_cur_text(1)
- return printf("\<ESC>:call %s(%s,%d)\<CR>", a:function, string(cur_text), col('.'))
-endfunction"}}}
-function! s:eval_snippet(snippet_text)"{{{
- let snip_word = ''
- let prev_match = 0
- let match = match(a:snippet_text, '\\\@<!`.\{-}\\\@<!`')
-
- while match >= 0
- if match - prev_match > 0
- let snip_word .= a:snippet_text[prev_match : match - 1]
- endif
- let prev_match = matchend(a:snippet_text, '\\\@<!`.\{-}\\\@<!`', match)
- let snip_word .= eval(a:snippet_text[match+1 : prev_match - 2])
-
- let match = match(a:snippet_text, '\\\@<!`.\{-}\\\@<!`', prev_match)
- endwhile
- if prev_match >= 0
- let snip_word .= a:snippet_text[prev_match :]
- endif
-
- return snip_word
-endfunction"}}}
-function! neocomplcache#sources#snippets_complete#get_snippets()"{{{
- " Get buffer filetype.
- let filetype = neocomplcache#get_context_filetype(1)
-
- let snippets = {}
- for source in neocomplcache#get_sources_list(s:snippets, filetype)
- call extend(snippets, source, 'keep')
- endfor
- call extend(snippets, copy(s:snippets['_']), 'keep')
-
- return snippets
-endfunction"}}}
-
-function! s:SID_PREFIX()
- return matchstr(expand('<sfile>'), '<SNR>\d\+_')
-endfunction
-
-" Plugin key-mappings.
-inoremap <silent><expr> <Plug>(neocomplcache_snippets_expand)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump')
-snoremap <silent><expr> <Plug>(neocomplcache_snippets_expand)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump')
-inoremap <silent><expr> <Plug>(neocomplcache_snippets_jump)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand')
-snoremap <silent><expr> <Plug>(neocomplcache_snippets_jump)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand')
-inoremap <silent><expr> <Plug>(neocomplcache_snippets_force_expand)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand')
-snoremap <silent><expr> <Plug>(neocomplcache_snippets_force_expand)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand')
-inoremap <silent><expr> <Plug>(neocomplcache_snippets_force_jump)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump')
-snoremap <silent><expr> <Plug>(neocomplcache_snippets_force_jump)
- \ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump')
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
-" vim: foldmethod=marker
View
16 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/_.snip
@@ -1,16 +0,0 @@
-# Global snippets
-
-snippet date
- `strftime("%d %b %Y")`
-
-snippet date_full
-alias df
- `strftime("%Y-%m-%dT%H:%M:%S")`
-
-snippet date_day
-alias dd
- `strftime("%Y-%m-%d")`
-
-snippet date_time
-alias dt
- `strftime("%H:%M:%S")`
View
273 vim/bundle/neocomplcache/autoload/neocomplcache/sources/snippets_complete/actionscript.snip
@@ -1,273 +0,0 @@
-snippet ec
- #endinitclip
-
-
-snippet inc
- #include "${1}"
-
-
-snippet br
- break;
-
-
-snippet ca
- call(${1:frame});
-
-
-snippet case
-abbr ce
- case ${1:expression} :
- ${1:statement}
-
-
-snippet catch
-abbr ch
- catch ($1) {
- $2
- }
-
-
-snippet class
- class ${1:ClassName} {
- var _${2};
- function ${1}(${2}){
- _${2} = ${2};${0}
- }
- }
-
-
-snippet co
- continue;
-
-
-snippet dt
- default :
- ${1:statement}
-
-
-snippet de
- delete ${1};
-
-
-snippet do
- do {
- ${1}
- } while (${2:condition});
-
-
-snippet dm
- duplicateMovieClip(${1:target}, ${2:newName}, ${3:depth});
-
-
-snippet ei
- else if (${1}) {
- ${2}
- }
-
-
-snippet fori
-abbr fi
- for ( var ${1} in ${2} ){
- ${3}
- };
-
-
-snippet for
-abbr fr
- for ( var ${1}=0; ${1}<${3}.length; ${1}++ ) {
- ${4}
- };
-
-
-snippet fs
- fscommand(${1:command}, ${2:paramaters});
-
-
-snippet fn
- function ${1}(${2}):${3}{
- ${4}
- };
-
-
-snippet gu
- getURL(${1});
-
-
-snippet gp
- gotoAndPlay(${1});
-
-
-snippet gs
- gotoAndStop(${1});
-
-snippet if
- if (${1}) {
- ${2}
- }
-
-
-snippet il
- ifFrameLoaded (${1}) {
- ${2}
- }
-
-
-snippet ip
- import ${1};
-
-
-snippet it
- interface ${1}{
- ${2}
- }
-
-
-snippet lm
- loadMovie( ${1:url}, ${2:target}, ${3:method});
-
-
-snippet ln
- loadMovieNum( ${1:url}, ${2:level}, ${3:method});
-
-
-snippet lv
- loadVariables( ${1:url}, ${2:target}, ${3:method});
-
-
-snippet vn
- loadVariables( ${1:url}, ${2:level}, ${3:method});
-
-
-snippet mc
- MovieClip
-
-
-snippet nf
- nextFrame();
-
-
-snippet ns
- nextScene();
-
-
-snippet on
- on (${1}) {
- ${2}
- };
-
-
-snippet oc
- onClipEvent (${1}) {
- ${2}
- };
-
-
-snippet pl
- play();
-
-
-snippet pf
- pravFrame();
-
-
-snippet ps
- prevScene();
-
-
-snippet pr
- print( ${1:target}, ${2:type} );
-
-
-snippet bn
- printAsBitmapNum( ${1:level}, ${2:type} );
-
-
-snippet pn
- printNum( ${1:level}, ${2:type} );
-
-
-snippet rm
- removeMovieClip( ${1:target} );
-
-
-snippet rt
- return ${1};
-
-
-snippet sp
- setProperty( ${1:target}, ${2:property}, ${3:value} );
-
-
-snippet sv
- set( ${1:name}, ${2:value} );
-