Merge pull request #178 from alpaca-tc/master

Append neosnippet_source to action_table.
This commit is contained in:
Shougo 2013-09-01 07:08:23 -07:00
commit c2f75620ec

View File

@ -27,18 +27,32 @@
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! unite#sources#neosnippet_file#define() "{{{ function! unite#sources#neosnippet_file#define() "{{{
return [s:source_user, s:source_runtime] return [s:source_user, s:source_runtime]
endfunction "}}} endfunction "}}}
" common action table
let s:action_table = {}
let s:action_table.neosnippet_source = {
\ 'description' : 'neosnippet_source file',
\ 'is_selectable' : 1,
\ 'is_quit' : 1,
\ }
function! s:action_table.neosnippet_source.func(candidates) "{{{
for candidate in a:candidates
let snippet_name = candidate.action__path
if snippet_name != ''
call neosnippet#source_file(snippet_name)
endif
endfor
endfunction"}}}
" neosnippet source. " neosnippet source.
let s:source_user = { let s:source_user = {
\ 'name': 'neosnippet/user', \ 'name': 'neosnippet/user',
\ 'description' : 'neosnippet user file', \ 'description' : 'neosnippet user file',
\ 'action_table' : {}, \ 'action_table' : copy(s:action_table),
\ } \ }
function! s:source_user.gather_candidates(args, context) "{{{ function! s:source_user.gather_candidates(args, context) "{{{
return s:get_snippet_candidates( return s:get_snippet_candidates(
\ neosnippet#get_user_snippets_directory()) \ neosnippet#get_user_snippets_directory())
@ -62,9 +76,8 @@ endfunction"}}}
let s:source_runtime = { let s:source_runtime = {
\ 'name': 'neosnippet/runtime', \ 'name': 'neosnippet/runtime',
\ 'description' : 'neosnippet runtime file', \ 'description' : 'neosnippet runtime file',
\ 'action_table' : {}, \ 'action_table' : copy(s:action_table),
\ } \ }
function! s:source_runtime.gather_candidates(args, context) "{{{ function! s:source_runtime.gather_candidates(args, context) "{{{
return s:get_snippet_candidates( return s:get_snippet_candidates(
\ neosnippet#get_runtime_snippets_directory()) \ neosnippet#get_runtime_snippets_directory())
@ -98,7 +111,6 @@ function! s:get_snippet_candidates(dirs) "{{{
return _ return _
endfunction "}}} endfunction "}}}
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo