forked from aniani/vim
patch 7.4.2237
Problem: Can't use "." and "$" with ":tab". Solution: Support a range for ":tab". (Hirohito Higashi)
This commit is contained in:
parent
920694c1b6
commit
9b7f8ce9eb
@ -87,14 +87,21 @@ In the GUI tab pages line you can use the right mouse button to open menu.
|
|||||||
Execute {cmd} and when it opens a new window open a new tab
|
Execute {cmd} and when it opens a new window open a new tab
|
||||||
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|
||||||
|:execute| and |:normal|.
|
|:execute| and |:normal|.
|
||||||
When [count] is omitted the tab page appears after the current
|
If [count] is given the new tab page appears after the tab
|
||||||
one.
|
page [count] otherwise the new tab page will appear after the
|
||||||
When [count] is specified the new tab page comes after tab
|
current one.
|
||||||
page [count]. Use ":0tab cmd" to get the new tab page as the
|
|
||||||
first one.
|
|
||||||
Examples: >
|
Examples: >
|
||||||
:tab split " opens current buffer in new tab page
|
:tab split " opens current buffer in new tab page
|
||||||
:tab help gt " opens tab page with help for "gt"
|
:tab help gt " opens tab page with help for "gt"
|
||||||
|
:.tab help gt " as above
|
||||||
|
:+tab help " opens tab page with help after the next
|
||||||
|
" tab page
|
||||||
|
:-tab help " opens tab page with help before the
|
||||||
|
" current one
|
||||||
|
:0tab help " opens tab page with help before the
|
||||||
|
" first one
|
||||||
|
:$tab help " opens tab page with help after the last
|
||||||
|
" one
|
||||||
|
|
||||||
CTRL-W gf Open a new tab page and edit the file name under the cursor.
|
CTRL-W gf Open a new tab page and edit the file name under the cursor.
|
||||||
See |CTRL-W_gf|.
|
See |CTRL-W_gf|.
|
||||||
@ -141,10 +148,11 @@ something else.
|
|||||||
given, then they become hidden. But modified buffers are
|
given, then they become hidden. But modified buffers are
|
||||||
never abandoned, so changes cannot get lost. >
|
never abandoned, so changes cannot get lost. >
|
||||||
:tabonly " close all tab pages except the current
|
:tabonly " close all tab pages except the current
|
||||||
|
" one
|
||||||
|
|
||||||
:{count}tabo[nly][!]
|
:{count}tabo[nly][!]
|
||||||
Close all tab pages except the {count}th one. >
|
Close all tab pages except the {count}th one. >
|
||||||
:.tabonly " one
|
:.tabonly " as above
|
||||||
:-tabonly " close all tab pages except the previous
|
:-tabonly " close all tab pages except the previous
|
||||||
" one
|
" one
|
||||||
:+tabonly " close all tab pages except the next one
|
:+tabonly " close all tab pages except the next one
|
||||||
|
@ -1858,9 +1858,7 @@ do_one_cmd(
|
|||||||
/*
|
/*
|
||||||
* 2. Handle command modifiers.
|
* 2. Handle command modifiers.
|
||||||
*/
|
*/
|
||||||
p = ea.cmd;
|
p = skip_range(ea.cmd, NULL);
|
||||||
if (VIM_ISDIGIT(*ea.cmd))
|
|
||||||
p = skipwhite(skipdigits(ea.cmd));
|
|
||||||
switch (*p)
|
switch (*p)
|
||||||
{
|
{
|
||||||
/* When adding an entry, also modify cmd_exists(). */
|
/* When adding an entry, also modify cmd_exists(). */
|
||||||
@ -1992,10 +1990,19 @@ do_one_cmd(
|
|||||||
case 't': if (checkforcmd(&p, "tab", 3))
|
case 't': if (checkforcmd(&p, "tab", 3))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_WINDOWS
|
#ifdef FEAT_WINDOWS
|
||||||
if (vim_isdigit(*ea.cmd))
|
long tabnr = get_address(&ea, &ea.cmd, ADDR_TABS,
|
||||||
cmdmod.tab = atoi((char *)ea.cmd) + 1;
|
ea.skip, FALSE);
|
||||||
else
|
if (tabnr == MAXLNUM)
|
||||||
cmdmod.tab = tabpage_index(curtab) + 1;
|
cmdmod.tab = tabpage_index(curtab) + 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tabnr < 0 || tabnr > LAST_TAB_NR)
|
||||||
|
{
|
||||||
|
errormsg = (char_u *)_(e_invrange);
|
||||||
|
goto doend;
|
||||||
|
}
|
||||||
|
cmdmod.tab = tabnr + 1;
|
||||||
|
}
|
||||||
ea.cmd = p;
|
ea.cmd = p;
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
|
@ -186,4 +186,36 @@ function Test_tabpage_with_autocmd()
|
|||||||
bw!
|
bw!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function Test_tabpage_with_tab_modifier()
|
||||||
|
for n in range(4)
|
||||||
|
tabedit
|
||||||
|
endfor
|
||||||
|
|
||||||
|
function s:check_tab(pre_nr, cmd, post_nr)
|
||||||
|
exec 'tabnext ' . a:pre_nr
|
||||||
|
exec a:cmd
|
||||||
|
call assert_equal(a:post_nr, tabpagenr())
|
||||||
|
call assert_equal('help', &filetype)
|
||||||
|
helpclose
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
call s:check_tab(1, 'tab help', 2)
|
||||||
|
call s:check_tab(1, '3tab help', 4)
|
||||||
|
call s:check_tab(1, '.tab help', 2)
|
||||||
|
call s:check_tab(1, '.+1tab help', 3)
|
||||||
|
call s:check_tab(1, '0tab help', 1)
|
||||||
|
call s:check_tab(2, '+tab help', 4)
|
||||||
|
call s:check_tab(2, '+2tab help', 5)
|
||||||
|
call s:check_tab(4, '-tab help', 4)
|
||||||
|
call s:check_tab(4, '-2tab help', 3)
|
||||||
|
call s:check_tab(3, '$tab help', 6)
|
||||||
|
call assert_fails('99tab help', 'E16:')
|
||||||
|
call assert_fails('+99tab help', 'E16:')
|
||||||
|
call assert_fails('-99tab help', 'E16:')
|
||||||
|
|
||||||
|
delfunction s:check_tab
|
||||||
|
tabonly!
|
||||||
|
bw!
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2237,
|
||||||
/**/
|
/**/
|
||||||
2236,
|
2236,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user