On 11/09/08 02:13, Kana Natsuno wrote:
> Hello, Vimmers.
>
> My friend and I noticed a strange behavior of Vim on foldings.
>   From :help 'foldopen':
>> When the command is part of a mapping this option is not used.
>
> For exmaple, with the following setting:
>
>       noremap g/  :<C-u>set incsearch<Return>/
>
> folds will be opened by '/' but not opened by 'g/'.  That's okay.
> This behavior is the same as noted in :help.
>
> But with the following settings:
>
>       noremap! ;<Return>
>       noremap!<Return>   ;

which swaps Enter and semicolon in Insert and Command-line mode. Strange 
idea. So you hit the Enter key to insert a semicolon into text, and you 
hit the semicolon key to break the line? Weird.

>
> folds will not be opened by BOTH '/' and 'g/'!  Entering {pattern}
> for '/' is usually finished by<Return>, but with the above
> settings<Return>  is mapped from ';'.  It seems to be the cause of
> this behavior.
>
> I believe that Vim should open folds in this case, because the
> conditions to open folds should determined by how {motion}
> commands are invoked, not how {pattern}s are inputed.  The
> following is a small patch to fix this problem:
>
>
> *** ../vim-7.2b.002/src/normal.c      Sun Sep  7 18:42:43 2008
> --- src/normal.c      Thu Sep 11 09:09:26 2008
> ***************
> *** 6076,6081 ****
> --- 6076,6082 ----
>         cmdarg_T          *cap;
>     {
>         oparg_T       *oap = cap->oap;
> +     int             save_KeyTyped;
>
>         if (cap->cmdchar == '?'&&  cap->oap->op_type == OP_ROT13)
>         {
> ***************
> *** 6086,6092 ****
> --- 6087,6095 ----
>       return;
>         }
>
> +     save_KeyTyped = KeyTyped;
>         cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0);
> +     KeyTyped = save_KeyTyped;
>
>         if (cap->searchbuf == NULL)
>         {
>
>
> Anyway, is this behavior intentional one?  If so, why Vim behaves
> as this?
>
>


Best regards,
Tony.
-- 
        The seven eyes of Ningauble the Wizard floated back to his hood
as he reported to Fafhrd: "I have seen much, yet cannot explain all.
The Gray Mouser is exactly twenty-five feet below the deepest cellar in
the palace of Gilpkerio Kistomerces.  Even though twenty-four parts in
twenty-five of him are dead, he is alive.

        "Now about Lankhmar.  She's been invaded, her walls breached
everywhere and desperate fighting is going on in the streets, by a
fierce host which out-numbers Lankhmar's inhabitants by fifty to one --
and equipped with all modern weapons.  Yet you can save the city."

        "How?" demanded Fafhrd.

        Ningauble shrugged.  "You're a hero.  You should know."
                -- Fritz Leiber, from "The Swords of Lankhmar"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui