inserting a date in gvim on windows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

inserting a date in gvim on windows

luke-44
Hi.

I am forced into using gvim on windows.
I'd like to use a macro I have on unix for inserting a date into text.

map! ;d ESC:r !date ^MiESCOA~~~~~~~~~~~~~~~~~~~~~~~~~~~ESCOB

obviously I can't use this on windows :-)

what can I use on windows to achieve the same effect.

Kind regards.
Luke.
--
............._..
.|  .| |.|/.|_ .
.|__.|_|.|\.|_ .
:61 421 276 282:
Reply | Threaded
Open this post in threaded view
|

Re: inserting a date in gvim on windows

Gary Johnson
On 2005-10-14, [hidden email] wrote:

> Hi.
>
> I am forced into using gvim on windows.
> I'd like to use a macro I have on unix for inserting a date into text.
>
> map! ;d ESC:r !date ^MiESCOA~~~~~~~~~~~~~~~~~~~~~~~~~~~ESCOB
>
> obviously I can't use this on windows :-)
>
> what can I use on windows to achieve the same effect.

    :help strftime()

Example:

    map! ;d <C-R>=strftime("today is %d %b %Y")<CR>

HTH,
Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Wireless Division
                             | Spokane, Washington, USA
Reply | Threaded
Open this post in threaded view
|

Re: inserting a date in gvim on windows

A.J.Mechelynck
In reply to this post by luke-44
[hidden email] wrote:

> Hi.
>
> I am forced into using gvim on windows.
> I'd like to use a macro I have on unix for inserting a date into text.
>
> map! ;d ESC:r !date ^MiESCOA~~~~~~~~~~~~~~~~~~~~~~~~~~~ESCOB
>
> obviously I can't use this on windows :-)
>
> what can I use on windows to achieve the same effect.
>
> Kind regards.
> Luke.

        :imap ;d <C-R>=strftime("%c")<CR>

Enter this as shown, e.g. by copy-paste.

"%c" means "the date and time as formatted by my OS by default" -- on my
machine it gave "14/10/2005 4:06:39" a few minutes ago but YMMV.
see ":help strftime()" for other format strings.

HTH,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: inserting a date in gvim on windows

luke-44
Hi.

14Oct2005 @ 04:09 A. J. Mechelynck thusly spake

> [hidden email] wrote:
> > Hi.
> >
> > I am forced into using gvim on windows.
> > I'd like to use a macro I have on unix for inserting a date into text.
> >
> > map! ;d ESC:r !date ^MiESCOA~~~~~~~~~~~~~~~~~~~~~~~~~~~ESCOB
> >
> > obviously I can't use this on windows :-)
> >
> > what can I use on windows to achieve the same effect.
> >
> > Kind regards.
> > Luke.
>
> :imap ;d <C-R>=strftime("%c")<CR>
>
> Enter this as shown, e.g. by copy-paste.
>
> "%c" means "the date and time as formatted by my OS by default" -- on my
> machine it gave "14/10/2005 4:06:39" a few minutes ago but YMMV.
> see ":help strftime()" for other format strings.

Thanks.
That did it :-)
Kind regards.
Luke.

--
............._..
.|  .| |.|/.|_ .
.|__.|_|.|\.|_ .
:61 421 276 282: