:tabclose + " close the next tab page
:tabclose 3 " close the third tab page
:tabclose $ " close the last tab page
+ :tabclose # " close the last accessed tab page
<
*:tabo* *:tabonly*
:tabo[nly][!] Close all other tab pages.
" one
:tabonly 1 " close all tab pages except the first one
:tabonly $ " close all tab pages except the last one
+ :tabonly # " close all tab pages except the last
+ " accessed one
SWITCHING TO ANOTHER TAB PAGE:
:+2tabnext " go to the two next tab page
:1tabnext " go to the first tab page
:$tabnext " go to the last tab page
+ :tabnext # " go to the last accessed tab page
:tabnext $ " as above
:tabnext - " go to the previous tab page
:tabnext -1 " as above
:tabmove " move the tab page to the last
:$tabmove " as above
:tabmove $ " as above
+ :tabmove # " move the tab page after the last accessed
+ " tab page
:tabm[ove] +[N]
:tabm[ove] -[N]
{
if (STRCMP(p, "$") == 0)
tab_number = LAST_TAB_NR;
+ else if (STRCMP(p, "#") == 0)
+ if (valid_tabpage(lastused_tabpage))
+ tab_number = tabpage_index(lastused_tabpage);
+ else
+ {
+ eap->errmsg = ex_errmsg(e_invargval, eap->arg);
+ tab_number = 0;
+ goto theend;
+ }
else if (p == p_save || *p_save == '-' || *p != NUL
|| tab_number > LAST_TAB_NR)
{
call assert_beeps('call feedkeys("g\<Tab>", "xt")')
call assert_beeps('call feedkeys("\<C-Tab>", "xt")')
call assert_beeps('call feedkeys("\<C-W>g\<Tab>", "xt")')
+ call assert_fails('tabnext #', 'E475:')
" open four tab pages
tabnew
call assert_equal(4, tabpagenr())
call assert_equal(2, tabpagenr('#'))
+ " Test for :tabnext #
+ tabnext #
+ call assert_equal(2, tabpagenr())
+ call assert_equal(4, tabpagenr('#'))
+
" Try to jump to a closed tab page
- tabclose 2
+ tabclose #
call assert_equal(0, tabpagenr('#'))
call feedkeys("g\<Tab>", "xt")
- call assert_equal(3, tabpagenr())
+ call assert_equal(2, tabpagenr())
call feedkeys("\<C-Tab>", "xt")
- call assert_equal(3, tabpagenr())
+ call assert_equal(2, tabpagenr())
call feedkeys("\<C-W>g\<Tab>", "xt")
- call assert_equal(3, tabpagenr())
+ call assert_equal(2, tabpagenr())
+ call assert_fails('tabnext #', 'E475:')
+ call assert_equal(2, tabpagenr())
- tabclose!
+ " Test for :tabonly #
+ let wnum = win_getid()
+ $tabnew
+ tabonly #
+ call assert_equal(wnum, win_getid())
+ call assert_equal(1, tabpagenr('$'))
+
+ " Test for :tabmove #
+ tabnew
+ let wnum = win_getid()
+ tabnew
+ tabnew
+ tabnext 2
+ tabmove #
+ call assert_equal(4, tabpagenr())
+ call assert_equal(wnum, win_getid())
+
+ tabonly!
endfunc
" vim: shiftwidth=2 sts=2 expandtab