On Mon, Nov 30, 2009 at 7:56 PM, sc <[email protected]> wrote:

> just wondering:  would you still want to do that if you knew vim
> supports its own strftime function?
>
>    :let td = strftime("%Y-%b-%d")
>
> will give you a nice 11 character string in 'td', and you can
> adjust to your preferences
>

I didn't know about that function, though I was interested in general
solution as well.

On Mon, Nov 30, 2009 at 9:05 PM, Gary Johnson <[email protected]> wrote:

> As sc wrote, strftime() is a better solution in this case.  However,
> for commands for which Vim does not have an internal equivalent, use
> system(), e.g.,
>
>    let stamp = system("date +%s")
>
> That will include the trailing newline in your stamp variable.  If
> that's undesirable, use this instead:
>
>    let stamp = substitute(system("date +%s"), '\n', '', '')
>
>
This is it.

Thank you all a lot!

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to