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

Re: Help with autocmd

Expand Messages
  • David Reed
    Well, I misspoke a little. I was able to get a skeleton loaded, but now I want to update the modified date and time whenever the file is saved. This example
    Message 1 of 3 , May 20, 2010
      Well, I misspoke a little.  I was able to get a skeleton loaded, but now I want to update the modified date and time whenever the file is saved.  This example is actually in the vim help menu, but I get an error. 



      On Thu, May 20, 2010 at 10:42 AM, Andrew Stewart <boss@...> wrote:

      On 20 May 2010, at 15:02, David Reed wrote:
      > Ultimately, I would like to be able to open a new .tex,.html,.c file and have it load a skeleton that automatically has the date created in the comment header as well as any other information.
      >
      > To this end my first attempt is just to have a file automatically add "I added this" at the top.  This is the code I put in my vimrc file and nothing is happening.
      >
      > :autocmd FileWritePre normal iI added this<Esc>
      >
      > Not sure what I am doing wrong.  Thanks for any help.

      Try the BufNewFile event:

         autocmd BufNewFile normal iIadded this

      See :help autocmd-events for more information about which events fire when.

      I also think you don't need <Esc>, but I'm not 100% sure about this.

      Regards,
      Andy Stewart

      -------
      http://airbladesoftware.com


      --
      You received this message from the "vim_mac" 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 from the "vim_mac" 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
    Your message has been successfully submitted and would be delivered to recipients shortly.