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>  ;

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?


-- 
To Vim, or not to Vim.
kana <http://whileimautomaton.net/>

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

Raspunde prin e-mail lui