blob: 1b075849bcd3e34dbf271eb5084a81acd3a79b0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
" File: sonictemplate.vim
" Author: kmnk <kmnknmk+vim@gmail.com>
" Version: 0.1.0
" License: BSD style license
let s:save_cpo = &cpo
set cpo&vim
function! unite#sources#sonictemplate#define()"{{{
return s:source
endfunction"}}}
let s:source = {
\ 'name' : 'sonictemplate',
\ 'description' : 'disp templates for sonictemplate',
\}
function! s:source.gather_candidates(args, context)"{{{
call unite#print_message('[sonictemplate]')
return 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"
\ }')
endfunction"}}}
" local functions {{{
function! s:to_template_name(path)
return substitute(fnamemodify(a:path, ':t:r'), '^\%(base\|snip\)-', '', '')
endfunction
" }}}
let &cpo = s:save_cpo
unlet s:save_cpo
" __END__
|