Hi,

On 2/20/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Tim Chase wrote:
>>>     :help <nop>
>>>
>>> but rather is being interpreted as "less-than, en, oh, pee,
>>> greater-than" and the "en" portion of it is trying to look for the
>>> last regexp.
>>
>> Try (untested):
>>
>> :inoremap <c-u> <c-o><lt>Nop><c-u>
>
> This is the behavior I _see_, but that I understood having "<nop>"
> should send a "no-op" keycode.  Thus, I had understood the mapping
>
> :inoremap <c-u> <c-o><nop><c-u>
>
> would act like typing "control+O [no-op character that clears the
> control-O (insert) mode] control+U".  This is the behavior I had expected.
>
> What you propose would act like typing "control+O less-than en oh pee
> greater-than control+U".  This is the behavior I see.
>
> The i_CTRL-G_u did what I wanted.  Thanks though,
>
> -tim
>

A little experimenting shows that <Nop> is only interpreted as do-nothing when
it is the _whole_ {rhs} of the mapping, as in

        :map <F6> <Nop>


Yes. In the Vim source code, the following code snippet is used by
the do_map() function in the getchar.c file:

      if (STRICMP(rhs, "<nop>") == 0)     /* "<Nop>" means nothing */
           rhs = (char_u *)"";
       else
           rhs = replace_termcodes(rhs, &arg_buf, FALSE, TRUE, special);

So <Nop> is treated as an empty key sequence only if it appears by itself
in the {rhs} of a mapping. I think, the help text for <Nop> should be
updated.

- Yegappan


; and in this case, ":map <F6>" will print the <Nop> in blue (or in whatever
colour your clourscheme assigns to the SpecialKey group). If it is not alone,
as in

        :map <F6> <Nop><Nop>

it is displayed in black (or in the "Normal" highlight colour) and means
less-than, N-for-November, o-for-Oscar, p-for-Papa, greater-than.


Reply via email to