Karsten Hopp 0754c4
To: vim-dev@vim.org
Karsten Hopp 0754c4
Subject: Patch 7.1.205
Karsten Hopp 0754c4
Fcc: outbox
Karsten Hopp 0754c4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 0754c4
Mime-Version: 1.0
Karsten Hopp 0754c4
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 0754c4
Content-Transfer-Encoding: 8bit
Karsten Hopp 0754c4
------------
Karsten Hopp 0754c4
Karsten Hopp 0754c4
Patch 7.1.205
Karsten Hopp 0754c4
Problem:    Can't get the operator in an ":omap".
Karsten Hopp 0754c4
Solution:   Add the "v:operator" variable. (Ben Schmidt)
Karsten Hopp 0754c4
Files:	    runtime/doc/eval.txt, src/eval.c, src/normal.c, src/vim.h
Karsten Hopp 0754c4
Karsten Hopp 0754c4
Karsten Hopp 0754c4
*** ../vim-7.1.204/runtime/doc/eval.txt	Tue Sep 25 17:54:41 2007
Karsten Hopp 0754c4
--- runtime/doc/eval.txt	Fri Jan  4 20:38:55 2008
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 1,4 ****
Karsten Hopp 0754c4
! *eval.txt*      For Vim version 7.1.  Last change: 2007 Sep 25
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 0754c4
--- 1,4 ----
Karsten Hopp 0754c4
! *eval.txt*      For Vim version 7.1.  Last change: 2008 Jan 04
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 1401,1410 ****
Karsten Hopp 0754c4
  		This is the screen column number, like with |virtcol()|.  The
Karsten Hopp 0754c4
  		value is zero when there was no mouse button click.
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  					*v:prevcount* *prevcount-variable*
Karsten Hopp 0754c4
  v:prevcount	The count given for the last but one Normal mode command.
Karsten Hopp 0754c4
  		This is the v:count value of the previous command.  Useful if
Karsten Hopp 0754c4
! 		you want to cancel Visual mode and then use the count. >
Karsten Hopp 0754c4
  			:vmap % <Esc>:call MyFilter(v:prevcount)<CR>
Karsten Hopp 0754c4
  <		Read-only.
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
--- 1401,1424 ----
Karsten Hopp 0754c4
  		This is the screen column number, like with |virtcol()|.  The
Karsten Hopp 0754c4
  		value is zero when there was no mouse button click.
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
+ 					*v:operator* *operator-variable*
Karsten Hopp 0754c4
+ v:operator	The last operator given in Normal mode.  This is a single
Karsten Hopp 0754c4
+ 		character except for commands starting with <g> or <z>,
Karsten Hopp 0754c4
+ 		in which case it is two characters.  Best used alongside
Karsten Hopp 0754c4
+ 		|v:prevcount| and |v:register|.  Useful if you want to cancel
Karsten Hopp 0754c4
+ 		Operator-pending mode and then use the operator, e.g.: >
Karsten Hopp 0754c4
+ 			:omap O <Esc>:call MyMotion(v:operator)<CR>
Karsten Hopp 0754c4
+ <		The value remains set until another operator is entered, thus
Karsten Hopp 0754c4
+ 		don't expect it to be empty.
Karsten Hopp 0754c4
+ 		v:operator is not set for |:delete|, |:yank| or other Ex
Karsten Hopp 0754c4
+ 		commands.
Karsten Hopp 0754c4
+ 		Read-only.
Karsten Hopp 0754c4
+ 
Karsten Hopp 0754c4
  					*v:prevcount* *prevcount-variable*
Karsten Hopp 0754c4
  v:prevcount	The count given for the last but one Normal mode command.
Karsten Hopp 0754c4
  		This is the v:count value of the previous command.  Useful if
Karsten Hopp 0754c4
! 		you want to cancel Visual or Operator-pending mode and then
Karsten Hopp 0754c4
! 		use the count, e.g.: >
Karsten Hopp 0754c4
  			:vmap % <Esc>:call MyFilter(v:prevcount)<CR>
Karsten Hopp 0754c4
  <		Read-only.
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
*** ../vim-7.1.204/src/eval.c	Fri Dec  7 17:08:35 2007
Karsten Hopp 0754c4
--- src/eval.c	Sat Jan  5 13:22:52 2008
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 345,350 ****
Karsten Hopp 0754c4
--- 345,351 ----
Karsten Hopp 0754c4
      {VV_NAME("mouse_win",	 VAR_NUMBER), 0},
Karsten Hopp 0754c4
      {VV_NAME("mouse_lnum",	 VAR_NUMBER), 0},
Karsten Hopp 0754c4
      {VV_NAME("mouse_col",	 VAR_NUMBER), 0},
Karsten Hopp 0754c4
+     {VV_NAME("operator",	 VAR_STRING), VV_RO},
Karsten Hopp 0754c4
  };
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  /* shorthand */
Karsten Hopp 0754c4
*** ../vim-7.1.204/src/normal.c	Thu Jan  3 13:19:50 2008
Karsten Hopp 0754c4
--- src/normal.c	Fri Jan  4 20:53:43 2008
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 141,146 ****
Karsten Hopp 0754c4
--- 141,149 ----
Karsten Hopp 0754c4
  static void	nv_Undo __ARGS((cmdarg_T *cap));
Karsten Hopp 0754c4
  static void	nv_tilde __ARGS((cmdarg_T *cap));
Karsten Hopp 0754c4
  static void	nv_operator __ARGS((cmdarg_T *cap));
Karsten Hopp 0754c4
+ #ifdef FEAT_EVAL
Karsten Hopp 0754c4
+ static void	set_op_var __ARGS((int optype));
Karsten Hopp 0754c4
+ #endif
Karsten Hopp 0754c4
  static void	nv_lineop __ARGS((cmdarg_T *cap));
Karsten Hopp 0754c4
  static void	nv_home __ARGS((cmdarg_T *cap));
Karsten Hopp 0754c4
  static void	nv_pipe __ARGS((cmdarg_T *cap));
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 7180,7185 ****
Karsten Hopp 0754c4
--- 7183,7191 ----
Karsten Hopp 0754c4
  	{
Karsten Hopp 0754c4
  	    cap->oap->start = curwin->w_cursor;
Karsten Hopp 0754c4
  	    cap->oap->op_type = OP_DELETE;
Karsten Hopp 0754c4
+ #ifdef FEAT_EVAL
Karsten Hopp 0754c4
+ 	    set_op_var(OP_DELETE);
Karsten Hopp 0754c4
+ #endif
Karsten Hopp 0754c4
  	    cap->count1 = 1;
Karsten Hopp 0754c4
  	    nv_dollar(cap);
Karsten Hopp 0754c4
  	    finish_op = TRUE;
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 8219,8226 ****
Karsten Hopp 0754c4
--- 8225,8257 ----
Karsten Hopp 0754c4
      {
Karsten Hopp 0754c4
  	cap->oap->start = curwin->w_cursor;
Karsten Hopp 0754c4
  	cap->oap->op_type = op_type;
Karsten Hopp 0754c4
+ #ifdef FEAT_EVAL
Karsten Hopp 0754c4
+ 	set_op_var(op_type);
Karsten Hopp 0754c4
+ #endif
Karsten Hopp 0754c4
+     }
Karsten Hopp 0754c4
+ }
Karsten Hopp 0754c4
+ 
Karsten Hopp 0754c4
+ #ifdef FEAT_EVAL
Karsten Hopp 0754c4
+ /*
Karsten Hopp 0754c4
+  * Set v:operator to the characters for "optype".
Karsten Hopp 0754c4
+  */
Karsten Hopp 0754c4
+     static void
Karsten Hopp 0754c4
+ set_op_var(optype)
Karsten Hopp 0754c4
+     int optype;
Karsten Hopp 0754c4
+ {
Karsten Hopp 0754c4
+     char_u	opchars[3];
Karsten Hopp 0754c4
+ 
Karsten Hopp 0754c4
+     if (optype == OP_NOP)
Karsten Hopp 0754c4
+ 	set_vim_var_string(VV_OP, NULL, 0);
Karsten Hopp 0754c4
+     else
Karsten Hopp 0754c4
+     {
Karsten Hopp 0754c4
+ 	opchars[0] = get_op_char(optype);
Karsten Hopp 0754c4
+ 	opchars[1] = get_extra_op_char(optype);
Karsten Hopp 0754c4
+ 	opchars[2] = NUL;
Karsten Hopp 0754c4
+ 	set_vim_var_string(VV_OP, opchars, -1);
Karsten Hopp 0754c4
      }
Karsten Hopp 0754c4
  }
Karsten Hopp 0754c4
+ #endif
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  /*
Karsten Hopp 0754c4
   * Handle linewise operator "dd", "yy", etc.
Karsten Hopp 0754c4
*** ../vim-7.1.204/src/vim.h	Sat Aug 11 13:57:31 2007
Karsten Hopp 0754c4
--- src/vim.h	Fri Jan  4 19:11:31 2008
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 1688,1694 ****
Karsten Hopp 0754c4
  #define VV_MOUSE_WIN	49
Karsten Hopp 0754c4
  #define VV_MOUSE_LNUM   50
Karsten Hopp 0754c4
  #define VV_MOUSE_COL	51
Karsten Hopp 0754c4
! #define VV_LEN		52	/* number of v: vars */
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  #ifdef FEAT_CLIPBOARD
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
--- 1688,1695 ----
Karsten Hopp 0754c4
  #define VV_MOUSE_WIN	49
Karsten Hopp 0754c4
  #define VV_MOUSE_LNUM   50
Karsten Hopp 0754c4
  #define VV_MOUSE_COL	51
Karsten Hopp 0754c4
! #define VV_OP		52
Karsten Hopp 0754c4
! #define VV_LEN		53	/* number of v: vars */
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
  #ifdef FEAT_CLIPBOARD
Karsten Hopp 0754c4
  
Karsten Hopp 0754c4
*** ../vim-7.1.204/src/version.c	Sat Jan  5 13:15:08 2008
Karsten Hopp 0754c4
--- src/version.c	Sat Jan  5 13:31:49 2008
Karsten Hopp 0754c4
***************
Karsten Hopp 0754c4
*** 668,669 ****
Karsten Hopp 0754c4
--- 668,671 ----
Karsten Hopp 0754c4
  {   /* Add new patch number below this line */
Karsten Hopp 0754c4
+ /**/
Karsten Hopp 0754c4
+     205,
Karsten Hopp 0754c4
  /**/
Karsten Hopp 0754c4
Karsten Hopp 0754c4
-- 
Karsten Hopp 0754c4
ARTHUR:  Then who is your lord?
Karsten Hopp 0754c4
WOMAN:   We don't have a lord.
Karsten Hopp 0754c4
ARTHUR:  What?
Karsten Hopp 0754c4
DENNIS:  I told you.  We're an anarcho-syndicalist commune.  We take it in
Karsten Hopp 0754c4
         turns to act as a sort of executive officer for the week.
Karsten Hopp 0754c4
                                  The Quest for the Holy Grail (Monty Python)
Karsten Hopp 0754c4
Karsten Hopp 0754c4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 0754c4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 0754c4
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 0754c4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///