Hello,

Backspacing or typing while the Vim 7 Insert completion popup window is running
is very difficult when the completion list is long or comes from many sources. 
Because the popup menu refreshes itself on each backspace, each keystroke can
take up to half a second to appear, and it was actually easier to hit escape
and re-enter insert mode to stop the popup menu guzzling CPU cycles on each
keystroke.

Miraculously, it was very easy for me to create an extra value for
'completeopt' which stops the popup menu as soon as something is backspaced or
added, and allows me to have the popup menu turned on, but without it getting
in my way as I type.

Do you think it would be worthwhile adding this patch into Vim?

regards,
Peter



Patch for the online help:
==========================

*** /usr/share/vim/vim70/doc/options.txt        Wed Sep 13 13:44:48 2006
--- doc/options.txt     Wed Sep 13 14:59:04 2006
***************
*** 1660,1665 ****
--- 1660,1671 ----
           preview  Show extra information about the currently selected
                    completion in the preview window.
  
+          stop     Stop Insert mode completion and close the popup menu when
+                   you start typing again, or when you backspace part of the
+                   completed text.  This is useful when the completion list
+                   is taking too long to refresh its contents while you are
+                   typing.
+ 
                                *'confirm'* *'cf'* *'noconfirm'* *'nocf'*
  'confirm' 'cf'                boolean (default off)
                        global



Patch for Vim 7 source (after patch 101)
========================================

*** vim70.orig/src/edit.c       Wed Sep 13 14:35:14 2006
--- vim70/src/edit.c    Wed Sep 13 14:26:45 2006
***************
*** 3019,3024 ****
--- 3019,3031 ----
      p = line + curwin->w_cursor.col;
      mb_ptr_back(line, p);
  
+     /*
+      * PETER HODGE - if completeopt contains 'stop', then stop
+      * insert completion when backspace is used
+      */
+     if (vim_strchr(p_cot, 's') != NULL)
+         return K_BS;
+ 
      /* Stop completion when the whole word was deleted. */
      if ((int)(p - line) - (int)compl_col <= 0)
        return K_BS;
***************
*** 3125,3130 ****
--- 3132,3146 ----
      else
  #endif
        ins_char(c);
+ 
+     /*
+      * PETER HODGE - if completeopt contains 'stop', then we want to
+      * clear completion mode
+      */
+     if (vim_strchr(p_cot, 's') != NULL) {
+         ins_compl_prep(' ');
+         return;
+     }
  
      /* If we didn't complete finding matches we must search again. */
      if (compl_was_interrupted)
*** vim70.orig/src/option.c     Wed Sep 13 14:35:15 2006
--- vim70/src/option.c  Wed Sep 13 14:27:19 2006
***************
*** 2848,2854 ****
  static char *(p_fcl_values[]) = {"all", NULL};
  #endif
  #ifdef FEAT_INS_EXPAND
! static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview",
NULL};
  #endif
  
  static void set_option_default __ARGS((int, int opt_flags, int compatible));
--- 2848,2855 ----
  static char *(p_fcl_values[]) = {"all", NULL};
  #endif
  #ifdef FEAT_INS_EXPAND
! /* PETER HODGE - added extra option 'stop' */
! static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview",
"stop", NULL};
  #endif
  
  static void set_option_default __ARGS((int, int opt_flags, int compatible));





                
____________________________________________________ 
Do you Yahoo!? 
Take part in Total GirlÂ’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au

Reply via email to