0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.1-205

This commit is contained in:
Bram Moolenaar
2008-01-05 12:35:21 +00:00
parent b52e532abe
commit 8af1fbf979
5 changed files with 52 additions and 3 deletions

View 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.

View 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 */

View 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,9 +8225,34 @@ 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.
*

View File

@@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
205,
/**/
204,
/**/

View File

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