aboutsummaryrefslogtreecommitdiff
path: root/autoload/unite
diff options
context:
space:
mode:
authorkmnk <kmnknmk+com-github@gmail.com>2012-03-08 14:41:36 +0900
committermattn <mattn.jp@gmail.com>2013-05-09 16:46:12 +0900
commit508cbfc369c432c6c2ee33f44940942def2c1845 (patch)
tree090b4c9a30c93372486b9321a76cdd9232700259 /autoload/unite
parentfb7c68116c686e816e6027d93b7eae9473bf6873 (diff)
downloadvim-sonictemplate-508cbfc369c432c6c2ee33f44940942def2c1845.tar.gz
vim-sonictemplate-508cbfc369c432c6c2ee33f44940942def2c1845.tar.bz2
vim-sonictemplate-508cbfc369c432c6c2ee33f44940942def2c1845.zip
add file kind to parents
Diffstat (limited to 'autoload/unite')
-rw-r--r--autoload/unite/kinds/sonictemplate.vim1
-rw-r--r--autoload/unite/sources/sonictemplate.vim24
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