]> granicus.if.org Git - vim/commitdiff
updated for version 7.1-205 v7.1.205
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Jan 2008 12:35:21 +0000 (12:35 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Jan 2008 12:35:21 +0000 (12:35 +0000)
runtime/doc/eval.txt
src/eval.c
src/normal.c
src/version.c
src/vim.h

index 6857ee51980e08f86088a164eb89fb585b499ea5..81c526963e885150c93c89f1106dcca376b0b68c 100644 (file)
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.1.  Last change: 2007 Sep 25
+*eval.txt*      For Vim version 7.1.  Last change: 2008 Jan 04
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1401,10 +1401,24 @@ v:mouse_col     Column number for a mouse click obtained with |getchar()|.
                This is the screen column number, like with |virtcol()|.  The
                value is zero when there was no mouse button click.
 
+                                       *v:operator* *operator-variable*
+v:operator     The last operator given in Normal mode.  This is a single
+               character except for commands starting with <g> or <z>,
+               in which case it is two characters.  Best used alongside
+               |v:prevcount| and |v:register|.  Useful if you want to cancel
+               Operator-pending mode and then use the operator, e.g.: >
+                       :omap O <Esc>:call MyMotion(v:operator)<CR>
+<              The value remains set until another operator is entered, thus
+               don't expect it to be empty.
+               v:operator is not set for |:delete|, |:yank| or other Ex
+               commands.
+               Read-only.
+
                                        *v:prevcount* *prevcount-variable*
 v:prevcount    The count given for the last but one Normal mode command.
                This is the v:count value of the previous command.  Useful if
-               you want to cancel Visual mode and then use the count. >
+               you want to cancel Visual or Operator-pending mode and then
+               use the count, e.g.: >
                        :vmap % <Esc>:call MyFilter(v:prevcount)<CR>
 <              Read-only.
 
index 8f6fcf37ceb008f8a57e12236db1e6fb9e69a236..aff284e0de5b89725cda880975f6d9c5adb1c921 100644 (file)
@@ -345,6 +345,7 @@ static struct vimvar
     {VV_NAME("mouse_win",       VAR_NUMBER), 0},
     {VV_NAME("mouse_lnum",      VAR_NUMBER), 0},
     {VV_NAME("mouse_col",       VAR_NUMBER), 0},
+    {VV_NAME("operator",        VAR_STRING), VV_RO},
 };
 
 /* shorthand */
index f5b76514b1591bc61330c41da2062e2fe03fc17c..f2c00898243e692eaabaf7495157837bdbcd223e 100644 (file)
@@ -141,6 +141,9 @@ static void nv_redo __ARGS((cmdarg_T *cap));
 static void    nv_Undo __ARGS((cmdarg_T *cap));
 static void    nv_tilde __ARGS((cmdarg_T *cap));
 static void    nv_operator __ARGS((cmdarg_T *cap));
+#ifdef FEAT_EVAL
+static void    set_op_var __ARGS((int optype));
+#endif
 static void    nv_lineop __ARGS((cmdarg_T *cap));
 static void    nv_home __ARGS((cmdarg_T *cap));
 static void    nv_pipe __ARGS((cmdarg_T *cap));
@@ -7180,6 +7183,9 @@ nv_optrans(cap)
        {
            cap->oap->start = curwin->w_cursor;
            cap->oap->op_type = OP_DELETE;
+#ifdef FEAT_EVAL
+           set_op_var(OP_DELETE);
+#endif
            cap->count1 = 1;
            nv_dollar(cap);
            finish_op = TRUE;
@@ -8219,8 +8225,33 @@ nv_operator(cap)
     {
        cap->oap->start = curwin->w_cursor;
        cap->oap->op_type = op_type;
+#ifdef FEAT_EVAL
+       set_op_var(op_type);
+#endif
+    }
+}
+
+#ifdef FEAT_EVAL
+/*
+ * Set v:operator to the characters for "optype".
+ */
+    static void
+set_op_var(optype)
+    int optype;
+{
+    char_u     opchars[3];
+
+    if (optype == OP_NOP)
+       set_vim_var_string(VV_OP, NULL, 0);
+    else
+    {
+       opchars[0] = get_op_char(optype);
+       opchars[1] = get_extra_op_char(optype);
+       opchars[2] = NUL;
+       set_vim_var_string(VV_OP, opchars, -1);
     }
 }
+#endif
 
 /*
  * Handle linewise operator "dd", "yy", etc.
index f9ad029a7bebce2e08c121e59a95a8d134fdb83b..c9508b969a2460ead939283b1cd6361288e5a52d 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    205,
 /**/
     204,
 /**/
index 05efc9a20e99b7adf55c40f91d8006643a22d078..bfbfde06e7b28cd8e41cc34f8ebb63dbc4795419 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1688,7 +1688,8 @@ int vim_memcmp __ARGS((void *, void *, size_t));
 #define VV_MOUSE_WIN   49
 #define VV_MOUSE_LNUM   50
 #define VV_MOUSE_COL   51
-#define VV_LEN         52      /* number of v: vars */
+#define VV_OP          52
+#define VV_LEN         53      /* number of v: vars */
 
 #ifdef FEAT_CLIPBOARD