| version 1.16, 2003/11/20 15:02:17 |
version 1.17, 2003/11/20 15:53:25 |
|
|
| " Vim global plugin for autoload template files |
" Vim global plugin for autoload template files |
| " File: templatefile.vim |
" File: templatefile.vim |
| " Maintainer: Lubomir Host 'rajo' <rajo AT platon.sk> |
" Maintainer: Lubomir Host 'rajo' <rajo AT platon.sk> |
| " Version: $Platon: vimconfig/vim/plugin/templatefile.vim,v 1.15 2003/11/18 13:49:50 rajo Exp $ |
" Version: $Platon: vimconfig/vim/plugin/templatefile.vim,v 1.16 2003/11/20 15:02:17 rajo Exp $ |
| " |
" |
| " Thanks: |
" Thanks: |
| " Scott Urban: First version of templatefile.vim |
" Scott Urban: First version of templatefile.vim |
| Line 79 function! LoadTemplateFile() |
|
| Line 79 function! LoadTemplateFile() |
|
| if exists("g:company") |
if exists("g:company") |
| let Company = Escape(g:company) |
let Company = Escape(g:company) |
| endif |
endif |
| |
|
| |
" build variable for @JAVA_PACKAGE@ substitution |
| |
" Suggested by Ondrej Jombik 'Nepto' <nepto AT platon.sk> |
| |
" Algoritmus description: |
| |
" nepto@platon.sk --> #.platon.sk --> sk.platon.@INCLUDE_GAURD@ |
| |
" rajo AT platon.sk --> #.platon.sk --> sk.platon.@INCLUDE_GAURD@ |
| |
let java_pkg = substitute(Email, '^[^@\s]\+\(@\|\s\+AT\s\+\)\(.*\)$', '#.\2', '') |
| |
while match(java_pkg, '#$') == -1 |
| |
let java_pkg = substitute(java_pkg, '^\([^#]*\)#\(.*\)\.\([a-zA-Z0-9_]\+\)$', '\1.\3#\2', 'g') |
| |
endwhile |
| |
let java_pkg = substitute(java_pkg, '^\.\(.*\)#$', '\1.' . tolower(inc_gaurd), '') |
| |
|
| silent! execute "%s/@DATE@/" . date . "/g" |
silent! execute "%s/@DATE@/" . date . "/g" |
| silent! execute "%s/@YEAR@/" . year . "/g" |
silent! execute "%s/@YEAR@/" . year . "/g" |
| silent! execute "%s/@LASTDIR@/" . lastdir . "/g" |
silent! execute "%s/@LASTDIR@/" . lastdir . "/g" |
| Line 89 function! LoadTemplateFile() |
|
| Line 101 function! LoadTemplateFile() |
|
| silent! execute "%s/@AUTHOR@/" . Author . "/g" |
silent! execute "%s/@AUTHOR@/" . Author . "/g" |
| silent! execute "%s/@EMAIL@/" . Email . "/g" |
silent! execute "%s/@EMAIL@/" . Email . "/g" |
| silent! execute "%s/@COMPANY@/" . Company . "/g" |
silent! execute "%s/@COMPANY@/" . Company . "/g" |
| |
silent! execute "%s/@JAVA_PACKAGE@/" . java_pkg . "/g" |
| if exists ("*" . template_func) |
if exists ("*" . template_func) |
| if exists("g:load_templates") |
if exists("g:load_templates") |
| if g:load_templates == "ask" |
if g:load_templates == "ask" |