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

Key mapping

Expand Messages
  • Luis R. Nunez
    I m trying (without success) to map key F11 in my .gvimrc file to turn off the syntax option and then resetting the gui foreground to a different color. My
    Message 1 of 9 , May 9, 2003
    • 0 Attachment
      I'm trying (without success) to map key F11 in my .gvimrc file to turn
      off the syntax option and then resetting the gui foreground to a
      different color. My attempt:

      map <F11> syn off<CR>hi normal guifg=green<CR>


      If the contents of the file I'm editing is:

      This is my example. Blah, blah, blah ...


      Then the result that I get after I press F11 is:

      yn off <== Notice the "s" is
      missing
      hi normal=green
      his my example. Blah, blah, blah ... <== Notice the "T" at
      the beginning is missing


      I read :he map-key-fails and it talks about removing the 'K' flag from
      my cpoptions. My cpoptions flags are set to "aABceFs". I'm using gvim
      (VIM version 6.1) and I start out initially with a dark background
      colorscheme (asu1dark).

      What's wrong with my mapping?

      Luis

      **************************************
      Luis R. Núñez
      Arrow Electronics, Inc.
      225 West Hillcrest Dr., Suite 200
      Thousand Oaks, CA  91360
      Phone: (805) 557-2272
      **************************************
       
       
       
    • Mikolaj Machowski
      ... ^ m. -- LaTeX + Vim = http://vim-latex.sourceforge.net/ Vim-list(s) Users Map: (last change 21 Apr) http://skawina.eu.org/mikolaj/vimlist Are You There?
      Message 2 of 9 , May 10, 2003
      • 0 Attachment
        On Fri, May 09, 2003 at 08:19:12PM -0700, Luis R. Nunez wrote:
        > map <F11> syn off<CR>hi normal guifg=green<CR>
        :syn off<CR>hi normal guifg=green<CR>
        ^

        m.
        --
        LaTeX + Vim = http://vim-latex.sourceforge.net/
        Vim-list(s) Users Map: (last change 21 Apr)
        http://skawina.eu.org/mikolaj/vimlist
        Are You There?
      • Piet Delport
        ... [snip pyrotechnics] Remember that the expansion of gets interpreted in normal mode, not command mode, so you re actually telling Vim to s ubstitute
        Message 3 of 9 , May 10, 2003
        • 0 Attachment
          On Fri, 09 May 2003 at 20:19:12 -0700, Luis R. Nunez wrote:
          >
          > I'm trying (without success) to map key F11 in my .gvimrc file to turn
          > off the syntax option and then resetting the gui foreground to a
          > different color. My attempt:
          >
          > map <F11> syn off<CR>hi normal guifg=green<CR>
          >
          [snip pyrotechnics]

          Remember that the expansion of <F11> gets interpreted in normal mode,
          not command mode, so you're actually telling Vim to "s"ubstitute the
          current character with "yn of<CR>[...]". To fix it, add colons where
          you would normally type them:

          :nnoremap <F11> :syn off<CR>:hi normal guifg=green<CR>

          --
          Piet Delport
          Today's subliminal thought is:
        • Luis R. Nunez
          Piet and Mikolaj, Thanks for the clarification. Luis  
          Message 4 of 9 , May 12, 2003
          • 0 Attachment
            Piet and Mikolaj,

            Thanks for the clarification.

            Luis
             
          • 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 5 of 9 , Jul 1, 2003
            • 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 6 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 7 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 8 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 9 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.