| version 1.2, 2002/02/06 00:43:23 |
version 1.3, 2002/02/06 01:13:40 |
| Line 21 augroup TemplateSystem |
|
| Line 21 augroup TemplateSystem |
|
| au BufNewFile * call LoadTemplateFile() |
au BufNewFile * call LoadTemplateFile() |
| augroup END |
augroup END |
| |
|
| |
command! -nargs=0 LoadTemplateFile call LoadTemplateFile() |
| |
command! -nargs=1 LoadFile call LoadFile(<args>) |
| |
|
| " template file loaded |
" template file loaded |
| fun! LoadTemplateFile() |
fun! LoadTemplateFile() |
| Line 82 fun! LoadTemplateFile() |
|
| Line 84 fun! LoadTemplateFile() |
|
| endfun |
endfun |
| |
|
| fun! LoadTemplateFileConfirm(filename) |
fun! LoadTemplateFileConfirm(filename) |
| if filereadable(a:filename) |
if filereadable(expand(a:filename)) |
| if exists("g:load_templates") |
if exists("g:load_templates") |
| if g:load_templates == "ask" |
if g:load_templates == "ask" |
| let choice = confirm("NEW FILE! Load template file?:", |
let choice = confirm("NEW FILE! Load template file " . |
| |
\ expand(a:filename) . " ?:", |
| \ "&yes\n" . |
\ "&yes\n" . |
| \ "&no\n") |
\ "&no\n") |
| if choice == 1 |
if choice == 1 |
| Line 100 fun! LoadTemplateFileConfirm(filename) |
|
| Line 103 fun! LoadTemplateFileConfirm(filename) |
|
| endif |
endif |
| endfun |
endfun |
| |
|
| |
fun! LoadFile(filename) |
| |
if filereadable(expand(a:filename)) |
| |
if exists("g:load_templates") |
| |
if g:load_templates == "ask" |
| |
let choice = confirm("Load file " . |
| |
\ expand(a:filename) . " ?:", |
| |
\ "&yes\n" . |
| |
\ "&no\n") |
| |
if choice == 1 |
| |
execute "0r " . a:filename |
| |
endif |
| |
elseif g:load_templates == "yes" |
| |
execute "0r " . a:filename |
| |
endif |
| |
else |
| |
execute "0r " . a:filename |
| |
endif |
| |
else |
| |
echo "File not found!" |
| |
endif |
| |
endfun |
| |
|
| " example for no-extension file specific template processing |
" example for no-extension file specific template processing |
| fun! TemplateFileFunc_noext_makefile() |
fun! TemplateFileFunc_noext_makefile() |
| let save_r = @r |
let save_r = @r |