4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Can't get the operator in an ":omap".
12 Solution: Add the "v:operator" variable. (Ben Schmidt)
13 Files: runtime/doc/eval.txt, src/eval.c, src/normal.c, src/vim.h
16 *** ../vim-7.1.204/runtime/doc/eval.txt Tue Sep 25 17:54:41 2007
17 --- runtime/doc/eval.txt Fri Jan 4 20:38:55 2008
20 ! *eval.txt* For Vim version 7.1. Last change: 2007 Sep 25
23 VIM REFERENCE MANUAL by Bram Moolenaar
25 ! *eval.txt* For Vim version 7.1. Last change: 2008 Jan 04
28 VIM REFERENCE MANUAL by Bram Moolenaar
31 This is the screen column number, like with |virtcol()|. The
32 value is zero when there was no mouse button click.
34 *v:prevcount* *prevcount-variable*
35 v:prevcount The count given for the last but one Normal mode command.
36 This is the v:count value of the previous command. Useful if
37 ! you want to cancel Visual mode and then use the count. >
38 :vmap % <Esc>:call MyFilter(v:prevcount)<CR>
42 This is the screen column number, like with |virtcol()|. The
43 value is zero when there was no mouse button click.
45 + *v:operator* *operator-variable*
46 + v:operator The last operator given in Normal mode. This is a single
47 + character except for commands starting with <g> or <z>,
48 + in which case it is two characters. Best used alongside
49 + |v:prevcount| and |v:register|. Useful if you want to cancel
50 + Operator-pending mode and then use the operator, e.g.: >
51 + :omap O <Esc>:call MyMotion(v:operator)<CR>
52 + < The value remains set until another operator is entered, thus
53 + don't expect it to be empty.
54 + v:operator is not set for |:delete|, |:yank| or other Ex
58 *v:prevcount* *prevcount-variable*
59 v:prevcount The count given for the last but one Normal mode command.
60 This is the v:count value of the previous command. Useful if
61 ! you want to cancel Visual or Operator-pending mode and then
62 ! use the count, e.g.: >
63 :vmap % <Esc>:call MyFilter(v:prevcount)<CR>
66 *** ../vim-7.1.204/src/eval.c Fri Dec 7 17:08:35 2007
67 --- src/eval.c Sat Jan 5 13:22:52 2008
71 {VV_NAME("mouse_win", VAR_NUMBER), 0},
72 {VV_NAME("mouse_lnum", VAR_NUMBER), 0},
73 {VV_NAME("mouse_col", VAR_NUMBER), 0},
74 + {VV_NAME("operator", VAR_STRING), VV_RO},
78 *** ../vim-7.1.204/src/normal.c Thu Jan 3 13:19:50 2008
79 --- src/normal.c Fri Jan 4 20:53:43 2008
83 static void nv_Undo __ARGS((cmdarg_T *cap));
84 static void nv_tilde __ARGS((cmdarg_T *cap));
85 static void nv_operator __ARGS((cmdarg_T *cap));
87 + static void set_op_var __ARGS((int optype));
89 static void nv_lineop __ARGS((cmdarg_T *cap));
90 static void nv_home __ARGS((cmdarg_T *cap));
91 static void nv_pipe __ARGS((cmdarg_T *cap));
96 cap->oap->start = curwin->w_cursor;
97 cap->oap->op_type = OP_DELETE;
99 + set_op_var(OP_DELETE);
108 cap->oap->start = curwin->w_cursor;
109 cap->oap->op_type = op_type;
111 + set_op_var(op_type);
118 + * Set v:operator to the characters for "optype".
126 + if (optype == OP_NOP)
127 + set_vim_var_string(VV_OP, NULL, 0);
130 + opchars[0] = get_op_char(optype);
131 + opchars[1] = get_extra_op_char(optype);
133 + set_vim_var_string(VV_OP, opchars, -1);
139 * Handle linewise operator "dd", "yy", etc.
140 *** ../vim-7.1.204/src/vim.h Sat Aug 11 13:57:31 2007
141 --- src/vim.h Fri Jan 4 19:11:31 2008
144 #define VV_MOUSE_WIN 49
145 #define VV_MOUSE_LNUM 50
146 #define VV_MOUSE_COL 51
147 ! #define VV_LEN 52 /* number of v: vars */
149 #ifdef FEAT_CLIPBOARD
152 #define VV_MOUSE_WIN 49
153 #define VV_MOUSE_LNUM 50
154 #define VV_MOUSE_COL 51
156 ! #define VV_LEN 53 /* number of v: vars */
158 #ifdef FEAT_CLIPBOARD
160 *** ../vim-7.1.204/src/version.c Sat Jan 5 13:15:08 2008
161 --- src/version.c Sat Jan 5 13:31:49 2008
165 { /* Add new patch number below this line */
171 ARTHUR: Then who is your lord?
172 WOMAN: We don't have a lord.
174 DENNIS: I told you. We're an anarcho-syndicalist commune. We take it in
175 turns to act as a sort of executive officer for the week.
176 The Quest for the Holy Grail (Monty Python)
178 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
179 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
180 \\\ download, build and distribute -- http://www.A-A-P.org ///
181 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///