Loading ...
Sorry, an error occurred while loading the content.

RE: inserting date

Expand Messages
  • Geoffrey Mann
    The following abbreviations can be added to your _vimrc or .vimrc file: date/time abbreviations Wed 01 Jan 2003 ab mdyl =strftime( %a %d %b %Y )
    Message 1 of 6 , Jun 3, 2003
    • 0 Attachment
      The following abbreviations can be added to your _vimrc or .vimrc file:

      "date/time abbreviations
      " Wed 01 Jan 2003
      ab mdyl <c-r>=strftime("%a %d %b %Y")<cr>
      " 030101
      ab mdys <c-r>=strftime("%y%m%d")<cr>
      " 01/01/2003 07:55:50
      ab mdyc <c-r>=strftime("%c")<cr>
      " 01/01/03 19:56:01
      ab hml <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
      " 19:56:06
      ab hms <c-r>=strftime("%H:%M:%S")<cr>

      These will allow a variety of formats for the current time.
      These are posted somewhere on the vim.org site but I forget where.

      Geoff

      -----Original Message-----
      From: Juan Pablo Aqueveque [mailto:juque@...]
      Sent: Tuesday, June 03, 2003 3:55 AM
      To: vim@...
      Subject: inserting date


      Hi guys!

      I am editing a file, but do I want you insert the current date, How I can
      insert it using a Vim command?
      thanks,

      ________________________________________________________
      Juan Pablo Aqueveque <juque@...>
      Ingeniero de Sistemas
      Departamento de Redes y Comunicaciones http://www.drc.uct.cl/
      Universidad Católica de Temuco.
      Tel:(5645) 205 630 Fax:(5645) 205 628
    • Hari Krishna Dara
      ... Just a couple of minor suggestions, if you are interested only in insert mode, you can use :iabbr instead of :abbr to reduce unexpected results. Also, use
      Message 2 of 6 , Jun 3, 2003
      • 0 Attachment
        On Tue, 3 Jun 2003 at 10:00am, Geoffrey Mann wrote:

        >
        > The following abbreviations can be added to your _vimrc or .vimrc file:
        >
        > "date/time abbreviations
        > " Wed 01 Jan 2003
        > ab mdyl <c-r>=strftime("%a %d %b %Y")<cr>
        > " 030101
        > ab mdys <c-r>=strftime("%y%m%d")<cr>
        > " 01/01/2003 07:55:50
        > ab mdyc <c-r>=strftime("%c")<cr>
        > " 01/01/03 19:56:01
        > ab hml <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
        > " 19:56:06
        > ab hms <c-r>=strftime("%H:%M:%S")<cr>
        >
        > These will allow a variety of formats for the current time.
        > These are posted somewhere on the vim.org site but I forget where.
        >
        > Geoff

        Just a couple of minor suggestions, if you are interested only in insert
        mode, you can use :iabbr instead of :abbr to reduce unexpected results.
        Also, use tokens that are hard to occur normally. I prefer surrounding
        them with back-slashes, so the above would become:

        iab \mdyl\ <c-r>=strftime("%a %d %b %Y")<cr>

        and so on.

        HTH,
        Hari

        __________________________________
        Do you Yahoo!?
        Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
        http://calendar.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.