]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.205
- updated to 0.7.5
[packages/vim.git] / 7.1.205
1 To: vim-dev@vim.org
2 Subject: Patch 7.1.205
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.1.205
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
14
15
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
18 ***************
19 *** 1,4 ****
20 ! *eval.txt*      For Vim version 7.1.  Last change: 2007 Sep 25
21   
22   
23                   VIM REFERENCE MANUAL    by Bram Moolenaar
24 --- 1,4 ----
25 ! *eval.txt*      For Vim version 7.1.  Last change: 2008 Jan 04
26   
27   
28                   VIM REFERENCE MANUAL    by Bram Moolenaar
29 ***************
30 *** 1401,1410 ****
31                 This is the screen column number, like with |virtcol()|.  The
32                 value is zero when there was no mouse button click.
33   
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>
39   <             Read-only.
40   
41 --- 1401,1424 ----
42                 This is the screen column number, like with |virtcol()|.  The
43                 value is zero when there was no mouse button click.
44   
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
55 +               commands.
56 +               Read-only.
57
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>
64   <             Read-only.
65   
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
68 ***************
69 *** 345,350 ****
70 --- 345,351 ----
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},
75   };
76   
77   /* shorthand */
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
80 ***************
81 *** 141,146 ****
82 --- 141,149 ----
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));
86 + #ifdef FEAT_EVAL
87 + static void   set_op_var __ARGS((int optype));
88 + #endif
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));
92 ***************
93 *** 7180,7185 ****
94 --- 7183,7191 ----
95         {
96             cap->oap->start = curwin->w_cursor;
97             cap->oap->op_type = OP_DELETE;
98 + #ifdef FEAT_EVAL
99 +           set_op_var(OP_DELETE);
100 + #endif
101             cap->count1 = 1;
102             nv_dollar(cap);
103             finish_op = TRUE;
104 ***************
105 *** 8219,8226 ****
106 --- 8225,8257 ----
107       {
108         cap->oap->start = curwin->w_cursor;
109         cap->oap->op_type = op_type;
110 + #ifdef FEAT_EVAL
111 +       set_op_var(op_type);
112 + #endif
113 +     }
114 + }
115
116 + #ifdef FEAT_EVAL
117 + /*
118 +  * Set v:operator to the characters for "optype".
119 +  */
120 +     static void
121 + set_op_var(optype)
122 +     int optype;
123 + {
124 +     char_u    opchars[3];
125
126 +     if (optype == OP_NOP)
127 +       set_vim_var_string(VV_OP, NULL, 0);
128 +     else
129 +     {
130 +       opchars[0] = get_op_char(optype);
131 +       opchars[1] = get_extra_op_char(optype);
132 +       opchars[2] = NUL;
133 +       set_vim_var_string(VV_OP, opchars, -1);
134       }
135   }
136 + #endif
137   
138   /*
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
142 ***************
143 *** 1688,1694 ****
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 */
148   
149   #ifdef FEAT_CLIPBOARD
150   
151 --- 1688,1695 ----
152   #define VV_MOUSE_WIN  49
153   #define VV_MOUSE_LNUM   50
154   #define VV_MOUSE_COL  51
155 ! #define VV_OP         52
156 ! #define VV_LEN                53      /* number of v: vars */
157   
158   #ifdef FEAT_CLIPBOARD
159   
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
162 ***************
163 *** 668,669 ****
164 --- 668,671 ----
165   {   /* Add new patch number below this line */
166 + /**/
167 +     205,
168   /**/
169
170 -- 
171 ARTHUR:  Then who is your lord?
172 WOMAN:   We don't have a lord.
173 ARTHUR:  What?
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)
177
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    ///
This page took 0.033808 seconds and 3 git commands to generate.