diff options
author | kmnk <kmnknmk+com-github@gmail.com> | 2012-03-08 14:41:36 +0900 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2013-05-09 16:46:12 +0900 |
commit | 508cbfc369c432c6c2ee33f44940942def2c1845 (patch) | |
tree | 090b4c9a30c93372486b9321a76cdd9232700259 /autoload | |
parent | fb7c68116c686e816e6027d93b7eae9473bf6873 (diff) | |
download | vim-sonictemplate-508cbfc369c432c6c2ee33f44940942def2c1845.tar.gz vim-sonictemplate-508cbfc369c432c6c2ee33f44940942def2c1845.tar.bz2 vim-sonictemplate-508cbfc369c432c6c2ee33f44940942def2c1845.zip |
add file kind to parents
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/unite/kinds/sonictemplate.vim | 1 | ||||
-rw-r--r-- | autoload/unite/sources/sonictemplate.vim | 24 |
2 files changed, 15 insertions, 10 deletions
diff --git a/autoload/unite/kinds/sonictemplate.vim b/autoload/unite/kinds/sonictemplate.vim index f15d640..2e61d9c 100644 --- a/autoload/unite/kinds/sonictemplate.vim +++ b/autoload/unite/kinds/sonictemplate.vim @@ -13,6 +13,7 @@ endfunction"}}} let s:kind = { \ 'name' : 'sonictemplate', \ 'default_action' : 'insert', +\ 'parents' : ['file'], \ 'action_table' : {}, \ 'alias_table' : {}, \} diff --git a/autoload/unite/sources/sonictemplate.vim b/autoload/unite/sources/sonictemplate.vim index dea3092..cb8fc1b 100644 --- a/autoload/unite/sources/sonictemplate.vim +++ b/autoload/unite/sources/sonictemplate.vim @@ -17,26 +17,30 @@ let s:source = { function! s:source.gather_candidates(args, context)"{{{ call unite#print_message('[sonictemplate]') - return map( -\ s:uniq(map(sonictemplate#templates(), 's:to_template_name(v:val)')), '{ -\ "word" : v:val, + return s:uniq(map( +\ sonictemplate#templates(), '{ +\ "word" : s:to_template_name(v:val), \ "source" : s:source.name, \ "kind" : s:source.name, -\ "action__mode" : len(a:args) > 0 ? args[0] : "n" +\ "action__mode" : len(a:args) > 0 ? args[0] : "n", +\ "action__name" : s:to_template_name(v:val), +\ "action__path" : v:val, \ }' -\ ) +\ )) endfunction"}}} " local functions {{{ -function! s:uniq(list) +function! s:uniq(candidates) let has = {} let uniq_list = [] - for i in a:list - if exists(printf("has['%s']", i)) + for candidate in a:candidates + echo candidate.action__path + let name = candidate.action__name + if exists(printf("has['%s']", name)) continue endif - let has[i] = 1 - call add(uniq_list, i) + let has[name] = 1 + call add(uniq_list, candidate) endfor return uniq_list endfunction |