| version 1.12, 2003/03/06 20:09:11 |
version 1.13, 2003/11/03 08:09:44 |
|
|
| " File: templatefile.vim |
" File: templatefile.vim |
| " Maintainer: Lubomir Host 'rajo' <8host AT pauli.fmph.uniba.sk> |
" Maintainer: Lubomir Host 'rajo' <8host AT pauli.fmph.uniba.sk> |
| " Last Change: 2003/01/10 |
" Last Change: 2003/01/10 |
| " Version: $Platon: vimconfig/vim/plugin/templatefile.vim,v 1.11 2003/02/28 05:43:24 rajo Exp $ |
" Version: $Platon: vimconfig/vim/plugin/templatefile.vim,v 1.12 2003/03/06 20:09:11 rajo Exp $ |
| " Thanks: |
" Thanks: |
| " Scott Urban: First version of templatefile.vim |
" Scott Urban: First version of templatefile.vim |
| " http://vim.sourceforge.net/scripts/script.php?script_id=198 |
" http://vim.sourceforge.net/scripts/script.php?script_id=198 |
| " Roland Lezuo: <roland.lezuo AT chello.at> |
" Roland Lezuo: <roland.lezuo AT chello.at> |
| " some suggestions |
" some suggestions |
| |
" Hojin Choi: <pynoos AT naver.com> |
| |
" function TryLoadTemplateInUpperDir() |
| " |
" |
| " Description: |
" Description: |
| " Plugin load template file for new files |
" Plugin load template file for new files |
| Line 47 function! LoadTemplateFile() |
|
| Line 49 function! LoadTemplateFile() |
|
| endif |
endif |
| if filereadable(expand($VIMTEMPLATE . template_file)) |
if filereadable(expand($VIMTEMPLATE . template_file)) |
| call LoadTemplateFileConfirm($VIMTEMPLATE . template_file) |
call LoadTemplateFileConfirm($VIMTEMPLATE . template_file) |
| |
elseif TryLoadTemplateInUpperDir("skel." . extension) |
| |
" I found a template file in an upper directory! |
| |
pwd |
| elseif filereadable(expand($HOME . "/.vim" . template_file)) |
elseif filereadable(expand($HOME . "/.vim" . template_file)) |
| call LoadTemplateFileConfirm($HOME . "/.vim" . template_file) |
call LoadTemplateFileConfirm($HOME . "/.vim" . template_file) |
| elseif filereadable(expand($VIM . template_file)) |
elseif filereadable(expand($VIM . template_file)) |
| Line 147 function! LoadFile(filename) |
|
| Line 152 function! LoadFile(filename) |
|
| endif |
endif |
| endfunction |
endfunction |
| |
|
| |
" function from Hojin Choi <pynoos AT naver.com> |
| |
fun! TryLoadTemplateInUpperDir(skelfile) |
| |
let savewd = getcwd() |
| |
while (getcwd() != "/") |
| |
if filereadable(a:skelfile) |
| |
call LoadTemplateFileConfirm(a:skelfile) |
| |
execute "cd " . savewd |
| |
return 1 |
| |
endif |
| |
if filereadable("templates/" . a:skelfile) |
| |
call LoadTemplateFileConfirm( "templates/" . a:skelfile) |
| |
execute "cd " . savewd |
| |
return 1 |
| |
endif |
| |
cd .. |
| |
endwhile |
| |
execute "cd " . savewd |
| |
return 0 |
| |
endfun |
| |
|
| |
|
| " example for no-extension file specific template processing |
" example for no-extension file specific template processing |
| function! TemplateFileFunc_noext_makefile() |
function! TemplateFileFunc_noext_makefile() |
| let save_r = @r |
let save_r = @r |