1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Can only move to a tab by absolute number.
12 Solution: Move a number of tabs to the left or the right. (Lech Lorens)
13 Files: runtime/doc/tabpage.txt, src/ex_cmds.h, src/ex_docmd.c,
14 src/testdir/test62.in, src/testdir/test62.ok, src/window.c
17 *** ../vim-7.3.590/runtime/doc/tabpage.txt 2010-08-15 21:57:17.000000000 +0200
18 --- runtime/doc/tabpage.txt 2012-07-06 18:10:06.000000000 +0200
24 :tabm[ove] [N] *:tabm* *:tabmove*
26 Move the current tab page to after tab page N. Use zero to
27 make the current tab page the first one. Without N the tab
28 page is made the last one.
32 + Move the current tab page N places to the right (with +) or to
35 + Note that although it is possible to move a tab behind the N-th one by using
36 + :Ntabmove, it is impossible to move it by N places by using :+Ntabmove. For
37 + clarification what +N means in this context see |[range]|.
40 LOOPING OVER TAB PAGES:
42 *** ../vim-7.3.590/src/ex_cmds.h 2012-05-18 18:47:11.000000000 +0200
43 --- src/ex_cmds.h 2012-07-06 18:10:13.000000000 +0200
46 EX(CMD_tabfirst, "tabfirst", ex_tabnext,
48 EX(CMD_tabmove, "tabmove", ex_tabmove,
49 ! RANGE|NOTADR|ZEROR|COUNT|TRLBAR|ZEROR),
50 EX(CMD_tablast, "tablast", ex_tabnext,
52 EX(CMD_tabnext, "tabnext", ex_tabnext,
54 EX(CMD_tabfirst, "tabfirst", ex_tabnext,
56 EX(CMD_tabmove, "tabmove", ex_tabmove,
57 ! RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR),
58 EX(CMD_tablast, "tablast", ex_tabnext,
60 EX(CMD_tabnext, "tabnext", ex_tabnext,
61 *** ../vim-7.3.590/src/ex_docmd.c 2012-06-06 19:02:40.000000000 +0200
62 --- src/ex_docmd.c 2012-07-06 18:16:25.000000000 +0200
68 ! tabpage_move(eap->addr_count == 0 ? 9999 : (int)eap->line2);
76 ! int tab_number = 9999;
78 ! if (eap->arg && *eap->arg != NUL)
80 ! char_u *p = eap->arg;
81 ! int relative = 0; /* argument +N/-N means: move N places to the
82 ! * right/left relative to the current position. */
84 ! if (*eap->arg == '-')
89 ! else if (*eap->arg == '+')
97 ! if (p == skipdigits(p))
99 ! /* No numbers as argument. */
100 ! eap->errmsg = e_invarg;
104 ! tab_number = getdigits(&p);
106 ! tab_number = tab_number * relative + tabpage_index(curtab) - 1;;
108 ! else if (eap->addr_count != 0)
109 ! tab_number = eap->line2;
111 ! tabpage_move(tab_number);
115 *** ../vim-7.3.590/src/testdir/test62.in 2012-03-07 22:55:17.000000000 +0100
116 --- src/testdir/test62.in 2012-07-06 18:10:13.000000000 +0200
123 + :for i in range(9) | tabnew | endfor
125 + Go
\12=tabpagenr()
\r\r\e
127 + i
\12=tabpagenr()
\r\r\e
129 + i
\12=tabpagenr()
\r\r\e
131 + i
\12=tabpagenr()
\r\r\e
133 + i
\12=tabpagenr()
\r\r\e
135 + i
\12=tabpagenr()
\r\r\e
137 + i
\12=tabpagenr()
\r\r\e
139 + i
\12=tabpagenr()
\r\r\e
141 + i
\12=tabpagenr()
\r\r\e
142 + :let a='No error caught.'
146 + :let a='E474 caught.'
151 :/^Results/,$w! test.out
154 *** ../vim-7.3.590/src/testdir/test62.ok 2012-02-22 19:13:00.000000000 +0100
155 --- src/testdir/test62.ok 2012-07-06 18:10:13.000000000 +0200
172 *** ../vim-7.3.590/src/window.c 2012-07-06 16:39:43.000000000 +0200
173 --- src/window.c 2012-07-06 18:10:13.000000000 +0200
178 /* Re-insert it at the specified position. */
181 curtab->tp_next = first_tabpage;
182 first_tabpage = curtab;
186 /* Re-insert it at the specified position. */
189 curtab->tp_next = first_tabpage;
190 first_tabpage = curtab;
191 *** ../vim-7.3.590/src/version.c 2012-07-06 17:51:24.000000000 +0200
192 --- src/version.c 2012-07-06 18:11:08.000000000 +0200
196 { /* Add new patch number below this line */
202 Bare feet magnetize sharp metal objects so they point upward from the
203 floor -- especially in the dark.
205 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
206 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
207 \\\ an exciting new programming language -- http://www.Zimbu.org ///
208 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///