"thedate" is seen as a literal string by the :w command. You need to
concatenate the value of thedate variable with the command:
exec "w %.".thedate

On Feb 20, 1:39 am, Labynocle <[email protected]> wrote:
> Hi there,
>
> I just begin with "Vim programmation" and I try to do a simple
> function like this :
>
> function! SaveAndDate()
>     let thedate=strftime("%Y%m%d-%H.%M.%S")
>     w
> %.thedate
> endf
>
> If I'm editing the file "plop.cfg" and I call my function SaveAndDate
> (), I create a new file (great !) which is named
> "plop.cfg.thedate" (bas :( ). I check with the echo command the
> content of "thedate" and it seems to be okay.
> So I don't understand why my variable "thedate" is not interpreted (is
> not very clear for me even if I read the Vim Guide).
>
> Any clue will be greatly appreciated
> Excuse my poor english level :)
>
> Erwan
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to