Quick links: help overview · quick reference · reference manual toc · command index
tabpage.txt For Vim version 8.2. Last change: 2019 May 05 VIM REFERENCE MANUAL by Bram Moolenaar Editing with windows in multiple tab pages. tab-page tabpage The commands which have been added to use multiple tab pages are explained here. Additionally, there are explanations for commands that work differently when used in combination with more than one tab page. 1. Introduction tab-page-intro 2. Commands tab-page-commands {not able to use multiple tab pages when the +windows feature was disabled at compile time} ============================================================================== 1. Introduction tab-page-intro A tab page holds one or more windows. You can easily switch between tab pages, so that you have several collections of windows to work on different things. Usually you will see a list of labels at the top of the Vim window, one for each tab page. With the mouse you can click on the label to jump to that tab page. There are other ways to move between tab pages, see below. Tabs are also a nice way to edit a buffer temporarily without changing the current window layout. Open a new tab page, do whatever you want to do and close the tab page. ============================================================================== 2. Commands tab-page-commands CLOSING A TAB PAGE: Closing the last window of a tab page closes the tab page too, unless there is only one tab page. Using the mouse: If the tab page line is displayed you can click in the "X" at the top right to close the current tab page. A custom 'tabline' may show something else. :tabc :tabclose :tabc[lose][!] Close current tab page. This command fails when: - There is only one tab page on the screen. E784 - When 'hidden' is not set, [!] is not used, a buffer has changes, and there is no other window on this buffer. Changes to the buffer are not written and won't get lost, so this is a "safe" command. :tabclose " close the current tab page :{count}tabc[lose][!] :tabc[lose][!] {count} Close tab page {count}. Fails in the same way as `:tabclose` above. :-tabclose " close the previous tab page :+tabclose " close the next tab page :1tabclose " close the first tab page :$tabclose " close the last tab page :tabclose -2 " close the two previous tab page :tabclose + " close the next tab page :tabclose 3 " close the third tab page :tabclose $ " close the last tab page :tabo :tabonly :tabo[nly][!] Close all other tab pages. When the 'hidden' option is set, all buffers in closed windows become hidden. When 'hidden' is not set, and the 'autowrite' option is set, modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is given, then they become hidden. But modified buffers are never abandoned, so changes cannot get lost. :tabonly " close all tab pages except the current " one :{count}tabo[nly][!] :tabo[nly][!] {count} Close all tab pages except {count} one. :.tabonly " as above :-tabonly " close all tab pages except the previous " one :+tabonly " close all tab pages except the next one :1tabonly " close all tab pages except the first one :$tabonly " close all tab pages except the last one :tabonly - " close all tab pages except the previous " one :tabonly +2 " close all tab pages except the two next " one :tabonly 1 " close all tab pages except the first one :tabonly $ " close all tab pages except the last one SWITCHING TO ANOTHER TAB PAGE: Using the mouse: If the tab page line is displayed you can click in a tab page label to switch to that tab page. Click where there is no label to go to the next tab page. 'tabline' :tabn[ext] :tabn :tabnext gt <C-PageDown> CTRL-<PageDown> <C-PageDown> gt i_CTRL-<PageDown> i_<C-PageDown> Go to the next tab page. Wraps around from the last to the first one. :{count}tabn[ext] :tabn[ext] {count} Go to tab page {count}. The first tab page has number one. :-tabnext " go to the previous tab page :+tabnext " go to the next 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 $ " as above :tabnext - " go to the previous tab page :tabnext -1 " as above :tabnext + " go to the next tab page :tabnext +1 " as above {count}<C-PageDown> {count}gt Go to tab page {count}. The first tab page has number one. :tabp[revious] :tabp :tabprevious gT :tabN :tabN[ext] :tabNext CTRL-<PageUp> <C-PageUp> <C-PageUp> i_CTRL-<PageUp> i_<C-PageUp> gT Go to the previous tab page. Wraps around from the first one to the last one. :tabp[revious] {count} :tabN[ext] {count} {count}<C-PageUp> {count}gT Go {count} tab pages back. Wraps around from the first one to the last one. Note that the use of {count} is different from :tabnext, where it is used as the tab page number. :tabr[ewind] :tabfir :tabfirst :tabr :tabrewind :tabfir[st] Go to the first tab page. :tabl :tablast :tabl[ast] Go to the last tab page. REORDERING TAB PAGES: :tabm[ove] [N] :tabm :tabmove :[N]tabm[ove] Move the current tab page to after tab page N. Use zero to make the current tab page the first one. N is counted before the move, thus if the second tab is the current one, `:tabmove 1` and `:tabmove 2` have no effect. Without N the tab page is made the last one. :.tabmove " do nothing :-tabmove " move the tab page to the left :+tabmove " move the tab page to the right :0tabmove " move the tab page to the beginning of the tab " list :tabmove 0 " as above :tabmove " move the tab page to the last :$tabmove " as above :tabmove $ " as above :tabm[ove] +[N] :tabm[ove] -[N] Move the current tab page N places to the right (with +) or to the left (with -). :tabmove - " move the tab page to the left :tabmove -1 " as above :tabmove + " move the tab page to the right :tabmove +1 " as above Note that although it is possible to move a tab behind the N-th one by using :Ntabmove. And move it by N places by using :+Ntabmove. For clarification what +N means in this context see [range].
Quick links: help overview · quick reference · reference manual toc · command index