Wednesday, November 4, 2015

problem in vim snippets

I am using templates for expanding few text, eg.

!File=[:EVAL:]expand('%')[:END:]
!Author=
!Created=[:EVAL:]strftime('%c')[:END:]
!Last Modified=[:EVAL:]strftime('%c')[:END:]
Program [:EVAL:]expand('%:t:r')[:END:]
Implicit None
<++>
End Program [:EVAL:]expand('%:t:r')[:END:]


And I am calling this as:

"let s:plugin_dir = $HOME.'/.vim/bundle/vimf90/'
let s:plugin_dir=filter(split(&rtp, ','), 'v:val =~ "/vimf90"')[0]
let s:templatedir=s:plugin_dir . '/templates/'
function! Prog(arg)
execute 'r ' . s:templatedir . a:arg . '.txt'
%substitute#\[:EVAL:\]\(.\{-\}\)\[:END:\]#\=eval(submatch(1))#ge
endfunction


So, I am expecting to have the snippet called. But what I am getting is:

!****<= A blank line at top
!File=i.f90
!Author=
!Created=Wed 04 Nov 2015 10:54:29 CET
!Last Modified=Wed 04 Nov 2015 10:54:29 CET
Program i
Implicit None
<++>
0 !****<= Dont know why this "0" is coming
End Program i
So, Though this is called properly, I am getting few crap line. Can you kindly help me cleaning them?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: