This adds a text object ('aa' or 'ii') for the entire buffer.  I don't
know if this is worthy of being included by default, but I find it
convenient for things such as gqaa and =aa.
diff -rc vim72.old/runtime/doc/motion.txt vim72.new/runtime/doc/motion.txt
*** vim72.old/runtime/doc/motion.txt    2008-08-09 14:22:59.000000000 +0000
--- vim72.new/runtime/doc/motion.txt    2009-04-13 06:14:48.000000000 +0000
***************
*** 650,655 ****
--- 650,659 ----
                        Special case: With a count of 2 the quotes are
                        included, but no extra white space as with a"/a'/a`.
  
+ aa                                                    *v_aa* *aa*
+ ii                                                    *v_ii* *ii*
+                       Shortcut to select the entire buffer.
+ 
  When used after an operator:
  For non-block objects:
        For the "a" commands: The operator applies to the object and the white
***************
*** 692,697 ****
--- 696,702 ----
        "dap"   delete a paragraph                      *dap*
        "diB"   delete inner '{' '}' block              *diB*
        "daB"   delete a '{' '}' block                  *daB*
+       "daa"   delete all text from the buffer         *daa*
  
  Note the difference between using a movement command and an object.  The
  movement command operates from here (cursor position) to where the movement
diff -rc vim72.old/src/normal.c vim72.new/src/normal.c
*** vim72.old/src/normal.c      2008-07-31 20:03:08.000000000 +0000
--- vim72.new/src/normal.c      2009-04-13 06:37:13.000000000 +0000
***************
*** 8912,8917 ****
--- 8912,8921 ----
                flag = current_quote(cap->oap, cap->count1, include,
                                                                  cap->nchar);
                break;
+       case 'a': /* 'aa' = whole buffer */
+       case 'i': 
+               flag = current_buffer(cap->oap);
+               break;
  #if 0 /* TODO */
        case 'S': /* "aS" = a section */
        case 'f': /* "af" = a filename */
diff -rc vim72.old/src/search.c vim72.new/src/search.c
*** vim72.old/src/search.c      2008-07-13 18:18:27.000000000 +0000
--- vim72.new/src/search.c      2009-04-13 06:34:53.000000000 +0000
***************
*** 4491,4496 ****
--- 4491,4523 ----
      return OK;
  }
  
+ /*
+  * Select entire buffer.
+  */
+     int
+ current_buffer(oap)
+     oparg_T   *oap;
+ {
+ #ifdef FEAT_VISUAL
+     if (VIsual_active)
+     {
+       VIsual.lnum = 1;
+       VIsual_mode = 'V';
+       redraw_curbuf_later(INVERTED);  /* update the inversion */
+       showmode();
+     }
+     else
+ #endif
+     {
+       oap->start.lnum = 1;
+       oap->start.col = 0;
+       oap->motion_type = MLINE;
+     }
+     curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+     curwin->w_cursor.col = 0;
+     return TRUE;
+ }
+ 
  #endif /* FEAT_TEXTOBJ */
  
  #if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(FEAT_TEXTOBJ) \

Attachment: pgpA9bmeBhwye.pgp
Description: PGP signature



Raspunde prin e-mail lui