diff options
author | mattn <mattn.jp@gmail.com> | 2012-06-06 22:49:28 +0900 |
---|---|---|
committer | mattn <mattn.jp@gmail.com> | 2012-06-06 22:49:28 +0900 |
commit | 74a125c9f307449b4ce20aeb9299ba24a8fcec99 (patch) | |
tree | c5aec13756dd68ca966e65d040bfa4256b67ecc3 | |
parent | 0ea807426e0eddb85fd48688b22c2847bed05e83 (diff) | |
download | vim-sonictemplate-74a125c9f307449b4ce20aeb9299ba24a8fcec99.tar.gz vim-sonictemplate-74a125c9f307449b4ce20aeb9299ba24a8fcec99.tar.bz2 vim-sonictemplate-74a125c9f307449b4ce20aeb9299ba24a8fcec99.zip |
add global template named as '_'.
-rw-r--r-- | autoload/sonictemplate.vim | 6 |
1 files changed, 6 insertions, 0 deletions
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 |