From 74a125c9f307449b4ce20aeb9299ba24a8fcec99 Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 6 Jun 2012 22:49:28 +0900 Subject: add global template named as '_'. --- autoload/sonictemplate.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim index eafb233..274775b 100644 --- a/autoload/sonictemplate.vim +++ b/autoload/sonictemplate.vim @@ -38,6 +38,9 @@ function! sonictemplate#complete(lead, cmdline, curpos) abort endfor endif endif + for tmpldir in s:tmpldir + let tmp += map(split(globpath(join([tmpldir, '_'], '/'), (search('[^ \t]', 'wn') ? 'snip-' : 'base-') . a:lead . '*.*'), "\n"), 'fnamemodify(v:val, ":t:r")[5:]') + endfor let candidate = [] for c in tmp if index(candidate, c) == -1 @@ -60,6 +63,9 @@ function! sonictemplate#apply(name, mode) abort let fsl = split(globpath(join([tmpldir, ft], '/'), (search('[^ \t]', 'wn') ? 'snip-' : 'base-') . name . '.*'), "\n") endif endif + if len(fsl) == 0 + let fsl = split(globpath(join([tmpldir, '_'], '/'), (search('[^ \t]', 'wn') ? 'snip-' : 'base-') . name . '.*'), "\n") + endif let fs += fsl endfor if len(fs) == 0 -- cgit v1.2.3-54-g00ecf