On 09/16/2011 01:37 PM, Marty Fried wrote:
On Fri, Sep 16, 2011 at 9:55 AM, Tim Chase <[email protected]
<mailto:[email protected]>> wrote:

    On 09/16/11 11:50, Marty Fried wrote:

            Often people map<c-l>  to :nohl<cr><c-l>

            I'm just curious about this... I usually just type :noh, but
            thought this

        might be a good idea.  However, I tried it, and it seemed to be
        recursive,
        as vim continually seemed to be repeating the command, and I was
        unable to
        enter any other commands, and had to close the window.

        I was able to do something similar which worked:
        map<c-l>  :nohl<cr>:redr<cr>

        Did I do something wrong?


    Sounds like you want :nnoremap instead of :nmap (the distinction
    being precisely this case where it can trigger recursive expansion).

Thanks, learned something new.  I'm not a heavy user of key mapping, so
I hadn't had to learn that one yet.

  -Marty


Always use nnoremap, inoremap, etc unless you have a good reason not to!
Otherwise even if it works fine, at a later point you may add a mapping
that will be triggered by one of the keys in map you've created.

 -ak

--
You received this message from the "vim_use" 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

Reply via email to