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

Key mapping

Expand Messages
  • Michael Metzger
    Does anyone know how to map the number 1 key on the {lhs} of the keyboard? I need to map escape sequences like ^[Oq to the corresponding number keys.
    Message 1 of 9 , Jul 1 8:41 AM
    • 0 Attachment
      Does anyone know how to map the number 1 key on the {lhs} of the keyboard?

      I need to map escape sequences like
      ^[Oq to the corresponding number keys.
    • Sean C. Hubbell
      Hello, 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
      Message 2 of 9 , May 4, 2004
      • 0 Attachment
        Hello,

        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. Is this
        even the right way to approach this?

        Thanks,

        Sean

        Sean C. Hubbell
        (256) 881-9933 Ext. 316
        (256) 426-8957 (Cell)
        Ternion Corporation
        3325 Triana Boulevard
        Huntsville, Alabama 35805
      • Luc Hermitte
        Hello, ... Why don t you use :put ? BTW, prefer :nnoremap to :map. -- Luc Hermitte http://hermitte.free.fr/vim/
        Message 3 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 4 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 5 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.