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

Creating a function from selecting the current word

Expand Messages
  • Sean C. Hubbell
    Hello, How can I go about getting the following from just typing in a name and expand to the following from a key mapping?
    Message 1 of 2 , Sep 1, 2004
    • 0 Attachment
      Hello,

      How can I go about getting the following from just typing in a name and
      expand to the following from a key mapping?

      /***************************************************************************
      ***/
      void FuncName (void)
      /***************************************************************************
      ***/
      {
      /* .

      History:
      01 Sep 04 - Created. SCHubbell
      */
      } /* FuncName */

      Currently I have a :read $VIM\MyTemplate.txt and then substitude using the
      function name. I then have a key mapping that I then use to insert the date:
      nnoremap <F4> $a<CR><HOME> <C-R>=expand (strftime("%d %b %y"))<CR> -
      Created. SCHubbell<ESC>

      Ideally I would like to do this in one step. Should I use a function or is
      this easy enough that I can somehow get the current word and load my
      template in a buffer, then do a substitute, and then paste the buffer into
      the current file? Does anyone have something like this currently that I
      could modify?

      Thanks for your time,

      Sean

      Sean C. Hubbell
      (256) 881-9933 Ext. 316
      (256) 426-8957 (Cell)
      Ternion Corporation
      3325 Triana Boulevard
      Huntsville, Alabama 35805
    • Luc Hermitte
      Hello, ... It is not exactly what you are looking for, but you can try the version of MuTemplate I ve bee working on [1]. It is possible to have the date
      Message 2 of 2 , Sep 1, 2004
      • 0 Attachment
        Hello,

        * On Wed, Sep 01, 2004 at 07:29:55AM -0500, Sean C. Hubbell <sch@...> wrote:
        > Currently I have a :read $VIM\MyTemplate.txt and then substitude using
        > the function name. I then have a key mapping that I then use to insert
        > the date: nnoremap <F4> $a<CR><HOME> <C-R>=expand
        > (strftime("%d %b %y"))<CR> - Created. SCHubbell<ESC>

        It is not exactly what you are looking for, but you can try the version
        of MuTemplate I've bee working on [1].
        It is possible to have the date automatically expanded and vim asking us
        about the name of the function.

        HTH,

        [1] http://hermitte.free.fr/vim/ressources/mu-template.tar.gz
        --
        Luc Hermitte
        http://hermitte.free.fr/vim/
      Your message has been successfully submitted and would be delivered to recipients shortly.