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

Re: Key mapping

Expand Messages
  • Luc Hermitte
    Hello, ... Why don t you use :put ? BTW, prefer :nnoremap to :map. -- Luc Hermitte http://hermitte.free.fr/vim/
    Message 1 of 9 , May 4, 2004
    • 0 Attachment
      Hello,

      * On Tue, May 04, 2004 at 09:00:24AM -0500, Sean C. Hubbell <sch@...> wrote:
      > void foo ()
      > {
      > /*
      > History:
      > 04 May 04 - blah.
      > */
      > }
      >
      > Here is what I have tried:
      > "map <F3> :s;\(^.*$\);\1CONTROLMHERE\ /*CONTROLMHERE
      > History:CONTROLMHERE .expand (strftime("%d %b %y"))CONTROLMHERE
      > \*\/;<CR>

      Why don't you use :put ?

      BTW, prefer :nnoremap to :map.


      --
      Luc Hermitte
      http://hermitte.free.fr/vim/
    • Yakov Lerner
      ... map $a /* History: =expand (strftime( %d %b %y )) */ Yakov
      Message 2 of 9 , May 4, 2004
      • 0 Attachment
        Sean C. Hubbell wrote:
        > I would like to add a key mapping to generate the history for my
        > particular source code function.
        > This is what I would like to key mapping to provide
        >
        > void foo ()
        > {
        > /*
        > History:
        > 04 May 04 - blah.
        > */
        > }
        >
        > Here is what I have tried:
        > "map <F3> :s;\(^.*$\);\1CONTROLMHERE\ /*CONTROLMHERE
        > History:CONTROLMHERE .expand (strftime("%d %b %y"))CONTROLMHERE
        > \*\/;<CR>
        >
        > But this does not work as the CONTROLM does not work as I expected.

        map <F3> $a<cr> /*<cr> History: <c-R>=expand (strftime("%d %b
        %y"))<cr><cr> */<esc>

        Yakov
      • Yakov Lerner
        ... Well it depended on your exact autoindentation settings but try the following which is supposed to work independently of settings: map $:set
        Message 3 of 9 , May 4, 2004
        • 0 Attachment
          Sean C. Hubbell wrote:

          > Thanks. Is there a way that I can align the ending c comment with the first
          > comment?

          Well it depended on your exact autoindentation settings but try
          the following which is supposed to work
          independently of settings:

          map <F3> $:set paste<cr>a<cr> /*<cr> History:
          <c-R>=expand(strftime("%d %b %y"))<cr><cr> */<esc>:set nopaste<cr>

          ; just play with spaces in the mapping to make it aligned to
          your taste.

          Yakov

          >
          > Sean
          >
          >
          >>-----Original Message-----
          >>From: Yakov Lerner [mailto:qlerner@...]
          >>Sent: Tuesday, May 04, 2004 10:31 AM
          >>To: Sean C. Hubbell
          >>Cc: Vim
          >>Subject: Re: Key mapping
          >>
          >>
          >>Sean C. Hubbell wrote:
          >>
          >>> I would like to add a key mapping to generate the history for my
          >>>particular source code function.
          >>>This is what I would like to key mapping to provide
          >>>
          >>>void foo ()
          >>>{
          >>> /*
          >>> History:
          >>> 04 May 04 - blah.
          >>> */
          >>>}
          >>>
          >>>Here is what I have tried:
          >>>"map <F3> :s;\(^.*$\);\1CONTROLMHERE\ /*CONTROLMHERE
          >>>History:CONTROLMHERE .expand (strftime("%d %b %y"))CONTROLMHERE
          >>>\*\/;<CR>
          >>>
          >>>But this does not work as the CONTROLM does not work as I expected.
          >>
          >>map <F3> $a<cr> /*<cr> History: <c-R>=expand (strftime("%d %b
          >>%y"))<cr><cr> */<esc>
          >>
          >>Yakov
          >>
          >>
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.