/usr/share/doc/vim/html/tabpage.html is in vim-doc 2:8.0.1453-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | <HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" content="text/html; charset=ISO-8859-1">
<TITLE>Vim documentation: tabpage</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>Vim documentation: tabpage</H1>
<A NAME="top"></A>
<A HREF="index.html">main help file</A>
<HR>
<PRE>
*<A NAME="tabpage.txt"></A><B>tabpage.txt</B>* For Vim version 8.0. Last change: 2016 Oct 20
VIM REFERENCE MANUAL by <A HREF="intro.html#Bram">Bram</A> <A HREF="intro.html#Moolenaar">Moolenaar</A>
Editing with <A HREF="windows.html#windows">windows</A> in multiple <A HREF="intro.html#tab">tab</A> pages. *<A NAME="tab-page"></A><B>tab-page</B>* *<A NAME="tabpage"></A><B>tabpage</B>*
The commands which have been added to use multiple <A HREF="intro.html#tab">tab</A> pages are explained
here. Additionally, there are explanations for commands that work differently
when used in combination with more than one <A HREF="intro.html#tab">tab</A> page.
1. Introduction |<A HREF="#tab-page-intro">tab-page-intro</A>|
2. Commands |<A HREF="#tab-page-commands">tab-page-commands</A>|
3. Other items |<A HREF="#tab-page-other">tab-page-other</A>|
4. Setting <A HREF="options.html#'tabline'">'tabline'</A> |<A HREF="#setting-tabline">setting-tabline</A>|
5. Setting <A HREF="options.html#'guitablabel'">'guitablabel'</A> |<A HREF="#setting-guitablabel">setting-guitablabel</A>|
{Vi does not have any of these commands}
{not able to use multiple <A HREF="intro.html#tab">tab</A> pages when the |<A HREF="various.html#+windows">+windows</A>| feature was disabled
at compile time}
==============================================================================
1. Introduction *<A NAME="tab-page-intro"></A><B>tab-page-intro</B>*
A <A HREF="intro.html#tab">tab</A> page holds one or more <A HREF="windows.html#windows">windows</A>. You can easily switch between <A HREF="intro.html#tab">tab</A>
pages, so that you have several collections of <A HREF="windows.html#windows">windows</A> to work on different
things.
Usually you will see a <A HREF="eval.html#list">list</A> of labels at the top of the Vim <A HREF="windows.html#window">window</A>, one for
each <A HREF="intro.html#tab">tab</A> page. With the mouse you can click on the label to jump to that <A HREF="intro.html#tab">tab</A>
page. There are other ways to move between <A HREF="intro.html#tab">tab</A> pages, see below.
Most commands work only in the current <A HREF="intro.html#tab">tab</A> page. That includes the |<A HREF="index.html#CTRL-W">CTRL-W</A>|
commands, |<A HREF="windows.html#:windo">:windo</A>|, |<A HREF="windows.html#:all">:all</A>| and |<A HREF="windows.html#:ball">:ball</A>| (when not using the |<A HREF="#:tab">:tab</A>| modifier).
The commands that are aware of other <A HREF="intro.html#tab">tab</A> pages than the current one are
mentioned below.
Tabs are also a <A HREF="todo.html#nice">nice</A> way to edit a buffer temporarily without <A HREF="change.html#changing">changing</A> the
current <A HREF="windows.html#window">window</A> layout. Open a new <A HREF="intro.html#tab">tab</A> page, <A HREF="diff.html#do">do</A> whatever you want to <A HREF="diff.html#do">do</A> and
close the <A HREF="intro.html#tab">tab</A> page.
==============================================================================
2. Commands *<A NAME="tab-page-commands"></A><B>tab-page-commands</B>*
OPENING A NEW TAB PAGE:
When starting Vim "vim <A HREF="starting.html#-p">-p</A> filename ..." opens each file argument in a separate
<A HREF="intro.html#tab">tab</A> page (up to <A HREF="options.html#'tabpagemax'">'tabpagemax'</A>). See |<A HREF="starting.html#-p">-p</A>|
A double click with the mouse in the non-GUI <A HREF="intro.html#tab">tab</A> pages line opens a new, empty
<A HREF="intro.html#tab">tab</A> page. It is placed left of the position of the click. The first click
may select another <A HREF="intro.html#tab">tab</A> page first, causing an extra screen update.
This also works in a few <A HREF="gui.html#GUI">GUI</A> versions, esp. <A HREF="os_win32.html#Win32">Win32</A> and <A HREF="gui_x11.html#Motif">Motif</A>. But only when
clicking right of the labels.
In the <A HREF="gui.html#GUI">GUI</A> <A HREF="intro.html#tab">tab</A> pages line you can use the right mouse button to open menu.
|<A HREF="#tabline-menu">tabline-menu</A>|.
For the related autocommands see |<A HREF="#tabnew-autocmd">tabnew-autocmd</A>|.
:[count]tabe[dit] *<A NAME=":tabe"></A><B>:tabe</B>* *<A NAME=":tabedit"></A><B>:tabedit</B>* *<A NAME=":tabnew"></A><B>:tabnew</B>*
:[count]tabnew
Open a new <A HREF="intro.html#tab">tab</A> page with an empty <A HREF="windows.html#window">window</A>, after the current
<A HREF="intro.html#tab">tab</A> page. If <A HREF="intro.html#[count]">[count]</A> is given the new <A HREF="intro.html#tab">tab</A> page appears after
the <A HREF="intro.html#tab">tab</A> page <A HREF="intro.html#[count]">[count]</A> otherwise the new <A HREF="intro.html#tab">tab</A> page will appear
after the current one.
<B> :tabnew " opens tabpage after the current one</B>
<B> :.tabnew " as above</B>
<B> :+tabnew " opens tabpage after the next tab page</B>
<B> " note: it is one further than :tabnew</B>
<B> :-tabnew " opens tabpage before the current one</B>
<B> :0tabnew " opens tabpage before the first one</B>
<B> :$tabnew " opens tabpage after the last one</B>
:[count]tabe[dit] <A HREF="editing.html#[++opt]">[++opt]</A> <A HREF="editing.html#[+cmd]">[+cmd]</A> <A HREF="editing.html#{file}">{file}</A>
:[count]tabnew <A HREF="editing.html#[++opt]">[++opt]</A> <A HREF="editing.html#[+cmd]">[+cmd]</A> <A HREF="editing.html#{file}">{file}</A>
Open a new <A HREF="intro.html#tab">tab</A> page and edit <A HREF="editing.html#{file}">{file}</A>, like with |<A HREF="editing.html#:edit">:edit</A>|.
For <A HREF="intro.html#[count]">[count]</A> see |<A HREF="#:tabnew">:tabnew</A>| above.
:[count]tabf[ind] <A HREF="editing.html#[++opt]">[++opt]</A> <A HREF="editing.html#[+cmd]">[+cmd]</A> <A HREF="editing.html#{file}">{file}</A> *<A NAME=":tabf"></A><B>:tabf</B>* *<A NAME=":tabfind"></A><B>:tabfind</B>*
Open a new <A HREF="intro.html#tab">tab</A> page and edit <A HREF="editing.html#{file}">{file}</A> in <A HREF="options.html#'path'">'path'</A>, like with
|<A HREF="editing.html#:find">:find</A>|. For <A HREF="intro.html#[count]">[count]</A> see |<A HREF="#:tabnew">:tabnew</A>| above.
{not available when the |<A HREF="various.html#+file_in_path">+file_in_path</A>| feature was disabled
at compile time}
:[count]tab {cmd} *<A NAME=":tab"></A><B>:tab</B>*
Execute {cmd} and when <A HREF="motion.html#it">it</A> opens a new <A HREF="windows.html#window">window</A> open a new <A HREF="intro.html#tab">tab</A>
page instead. Doesn't work for |<A HREF="diff.html#:diffsplit">:diffsplit</A>|, |<A HREF="diff.html#:diffpatch">:diffpatch</A>|,
|<A HREF="eval.html#:execute">:execute</A>| and |<A HREF="various.html#:normal">:normal</A>|.
If <A HREF="intro.html#[count]">[count]</A> is given the new <A HREF="intro.html#tab">tab</A> page appears after the <A HREF="intro.html#tab">tab</A>
page <A HREF="intro.html#[count]">[count]</A> otherwise the new <A HREF="intro.html#tab">tab</A> page will appear after the
current one.
Examples:
<B> :tab split " opens current buffer in new tab page</B>
<B> :tab help gt " opens tab page with help for "gt"</B>
<B> :.tab help gt " as above</B>
<B> :+tab help " opens tab page with help after the next</B>
<B> " tab page</B>
<B> :-tab help " opens tab page with help before the</B>
<B> " current one</B>
<B> :0tab help " opens tab page with help before the</B>
<B> " first one</B>
<B> :$tab help " opens tab page with help after the last</B>
<B> " one</B>
<A HREF="index.html#CTRL-W">CTRL-W</A> <A HREF="editing.html#gf">gf</A> Open a new <A HREF="intro.html#tab">tab</A> page and edit the file name under the cursor.
See |<A HREF="windows.html#CTRL-W_gf">CTRL-W_gf</A>|.
<A HREF="index.html#CTRL-W">CTRL-W</A> <A HREF="editing.html#gF">gF</A> Open a new <A HREF="intro.html#tab">tab</A> page and edit the file name under the cursor
and jump to the line number following the file name.
See |<A HREF="windows.html#CTRL-W_gF">CTRL-W_gF</A>|.
CLOSING A TAB PAGE:
Closing the last <A HREF="windows.html#window">window</A> of a <A HREF="intro.html#tab">tab</A> page closes the <A HREF="intro.html#tab">tab</A> page too, unless there is
only one <A HREF="intro.html#tab">tab</A> page.
Using the mouse: If the <A HREF="intro.html#tab">tab</A> page line is displayed you can click in the "<A HREF="change.html#X">X</A>" at
the top right to close the current tab page. A custom |<A HREF="options.html#'tabline'">'tabline'</A>| may show
something else.
*<A NAME=":tabc"></A><B>:tabc</B>* *<A NAME=":tabclose"></A><B>:tabclose</B>*
:tabc[lose][!] Close current <A HREF="intro.html#tab">tab</A> page.
This command fails when:
- There is only one <A HREF="intro.html#tab">tab</A> page on the screen. *<A NAME="E784"></A><B>E784</B>*
- When <A HREF="options.html#'hidden'">'hidden'</A> is not set, [!] is not used, a buffer has
changes, and there is no other <A HREF="windows.html#window">window</A> on this buffer.
Changes to the buffer are not written and won't get lost, so
this is a "safe" command.
<B> :tabclose " close the current tab page</B>
:{count}tabc[lose][!]
:tabc[lose][!] {count}
Close <A HREF="intro.html#tab">tab</A> page {count}. Fails in the same way <A HREF="motion.html#as">as</A> `:tabclose`
above.
<B> :-tabclose " close the previous tab page</B>
<B> :+tabclose " close the next tab page</B>
<B> :1tabclose " close the first tab page</B>
<B> :$tabclose " close the last tab page</B>
<B> :tabclose -2 " close the two previous tab page</B>
<B> :tabclose + " close the next tab page</B>
<B> :tabclose 3 " close the third tab page</B>
<B> :tabclose $ " close the last tab page</B>
*<A NAME=":tabo"></A><B>:tabo</B>* *<A NAME=":tabonly"></A><B>:tabonly</B>*
:tabo[nly][!] Close all other <A HREF="intro.html#tab">tab</A> pages.
When the <A HREF="options.html#'hidden'">'hidden'</A> option is set, all <A HREF="windows.html#buffers">buffers</A> in closed <A HREF="windows.html#windows">windows</A>
become hidden.
When <A HREF="options.html#'hidden'">'hidden'</A> is not set, and the <A HREF="options.html#'autowrite'">'autowrite'</A> option is set,
modified <A HREF="windows.html#buffers">buffers</A> are written. Otherwise, <A HREF="windows.html#windows">windows</A> that have
<A HREF="windows.html#buffers">buffers</A> that are modified are not removed, unless the [!] is
given, then they become hidden. But modified <A HREF="windows.html#buffers">buffers</A> are
never abandoned, so changes cannot get lost.
<B> :tabonly " close all tab pages except the current</B>
<B> " one</B>
:{count}tabo[nly][!]
:tabo[nly][!] {count}
Close all <A HREF="intro.html#tab">tab</A> pages except {count} one.
<B> :.tabonly " as above</B>
<B> :-tabonly " close all tab pages except the previous</B>
<B> " one</B>
<B> :+tabonly " close all tab pages except the next one</B>
<B> :1tabonly " close all tab pages except the first one</B>
<B> :$tabonly " close all tab pages except the last one</B>
<B> :tabonly - " close all tab pages except the previous</B>
<B> " one</B>
<B> :tabonly +2 " close all tab pages except the two next</B>
<B> " one</B>
<B> :tabonly 1 " close all tab pages except the first one</B>
<B> :tabonly $ " close all tab pages except the last one</B>
SWITCHING TO ANOTHER TAB PAGE:
Using the mouse: If the <A HREF="intro.html#tab">tab</A> page line is displayed you can click in a <A HREF="intro.html#tab">tab</A> page
label to switch to that <A HREF="intro.html#tab">tab</A> page. Click where there is no label to go to the
next tab page. |<A HREF="options.html#'tabline'">'tabline'</A>|
:tabn[ext] *<A NAME=":tabn"></A><B>:tabn</B>* *<A NAME=":tabnext"></A><B>:tabnext</B>* *<A NAME="gt"></A><B>gt</B>*
<A HREF="#<C-PageDown>"><C-PageDown></A> *<A NAME="CTRL-<PageDown>"></A><B>CTRL-<PageDown></B>* *<A NAME="<C-PageDown>"></A><B><C-PageDown></B>*
<A HREF="#gt">gt</A> *<A NAME="i_CTRL-<PageDown>"></A><B>i_CTRL-<PageDown></B>* *<A NAME="i_<C-PageDown>"></A><B>i_<C-PageDown></B>*
Go to the next <A HREF="intro.html#tab">tab</A> page. Wraps around from the last to the
first one.
:{count}tabn[ext]
:tabn[ext] {count}
Go to <A HREF="intro.html#tab">tab</A> page {count}. The first <A HREF="intro.html#tab">tab</A> page has number one.
<B> :-tabnext " go to the previous tab page</B>
<B> :+tabnext " go to the next tab page</B>
<B> :+2tabnext " go to the two next tab page</B>
<B> :1tabnext " go to the first tab page</B>
<B> :$tabnext " go to the last tab page</B>
<B> :tabnext $ " as above</B>
<B> :tabnext - " go to the previous tab page</B>
<B> :tabnext -1 " as above</B>
<B> :tabnext + " go to the next tab page</B>
<B> :tabnext +1 " as above</B>
{count}<C-PageDown>
{count}gt Go to <A HREF="intro.html#tab">tab</A> page {count}. The first <A HREF="intro.html#tab">tab</A> page has number one.
:tabp[revious] *<A NAME=":tabp"></A><B>:tabp</B>* *<A NAME=":tabprevious"></A><B>:tabprevious</B>* *<A NAME="gT"></A><B>gT</B>* *<A NAME=":tabN"></A><B>:tabN</B>*
:tabN[ext] *<A NAME=":tabNext"></A><B>:tabNext</B>* *<A NAME="CTRL-<PageUp>"></A><B>CTRL-<PageUp></B>*
<A HREF="#<C-PageUp>"><C-PageUp></A> *<A NAME="<C-PageUp>"></A><B><C-PageUp></B>* *<A NAME="i_CTRL-<PageUp>"></A><B>i_CTRL-<PageUp></B>* *<A NAME="i_<C-PageUp>"></A><B>i_<C-PageUp></B>*
<A HREF="#gT">gT</A> Go to the previous <A HREF="intro.html#tab">tab</A> page. Wraps around from the first one
to the last one.
:tabp[revious] {count}
:tabN[ext] {count}
{count}<C-PageUp>
{count}gT Go {count} <A HREF="intro.html#tab">tab</A> pages back. Wraps around from the first one
to the last one.
:tabr[ewind] *<A NAME=":tabfir"></A><B>:tabfir</B>* *<A NAME=":tabfirst"></A><B>:tabfirst</B>* *<A NAME=":tabr"></A><B>:tabr</B>* *<A NAME=":tabrewind"></A><B>:tabrewind</B>*
:tabfir[st] Go to the first <A HREF="intro.html#tab">tab</A> page.
*<A NAME=":tabl"></A><B>:tabl</B>* *<A NAME=":tablast"></A><B>:tablast</B>*
:tabl[ast] Go to the last <A HREF="intro.html#tab">tab</A> page.
Other commands:
*<A NAME=":tabs"></A><B>:tabs</B>*
<A HREF="#:tabs">:tabs</A> <A HREF="eval.html#List">List</A> the <A HREF="intro.html#tab">tab</A> pages and the <A HREF="windows.html#windows">windows</A> they contain.
Shows a "<A HREF="change.html#>">></A>" for the current <A HREF="windows.html#window">window</A>.
Shows a "<A HREF="motion.html#+">+</A>" for modified <A HREF="windows.html#buffers">buffers</A>.
For example:
<B><FONT COLOR="PURPLE"> Tab page 1 </FONT></B>
<B><FONT COLOR="PURPLE"> + tabpage.txt </FONT></B>
<B><FONT COLOR="PURPLE"> ex_docmd.c </FONT></B>
<B><FONT COLOR="PURPLE"> Tab page 2 </FONT></B>
<B><FONT COLOR="PURPLE"> > main.c </FONT></B>
REORDERING TAB PAGES:
:tabm[ove] [N] *<A NAME=":tabm"></A><B>:tabm</B>* *<A NAME=":tabmove"></A><B>:tabmove</B>*
:[N]tabm[ove]
Move the current <A HREF="intro.html#tab">tab</A> page to after <A HREF="intro.html#tab">tab</A> page N. Use zero to
make the current <A HREF="intro.html#tab">tab</A> page the first one. Without N the <A HREF="intro.html#tab">tab</A>
page is made the last one.
<B> :.tabmove " do nothing</B>
<B> :-tabmove " move the tab page to the left</B>
<B> :+tabmove " move the tab page to the right</B>
<B> :0tabmove " move the tab page to the beginning of the tab</B>
<B> " list</B>
<B> :tabmove 0 " as above</B>
<B> :tabmove " move the tab page to the last</B>
<B> :$tabmove " as above</B>
<B> :tabmove $ " as above</B>
:tabm[ove] +[N]
:tabm[ove] -[N]
Move the current <A HREF="intro.html#tab">tab</A> page N places to the right (with +) or to
the left (with -).
<B> :tabmove - " move the tab page to the left</B>
<B> :tabmove -1 " as above</B>
<B> :tabmove + " move the tab page to the right</B>
<B> :tabmove +1 " as above</B>
Note that although <A HREF="motion.html#it">it</A> is possible to move a <A HREF="intro.html#tab">tab</A> behind the N-th one by using
:Ntabmove. And move <A HREF="motion.html#it">it</A> by N places by using :+Ntabmove. For clarification what
+N means in this context see |<A HREF="cmdline.html#[range]">[range]</A>|.
LOOPING OVER TAB PAGES:
*<A NAME=":tabd"></A><B>:tabd</B>* *<A NAME=":tabdo"></A><B>:tabdo</B>*
:[range]tabd[o] {cmd}
Execute {cmd} in each <A HREF="intro.html#tab">tab</A> page or if <A HREF="cmdline.html#[range]">[range]</A> is given only in
<A HREF="intro.html#tab">tab</A> pages which <A HREF="intro.html#tab">tab</A> page number is in the <A HREF="cmdline.html#[range]">[range]</A>. It works
like doing this:
<B> :tabfirst</B>
<B> :{cmd}</B>
<B> :tabnext</B>
<B> :{cmd}</B>
<B> etc.</B>
This only operates in the current <A HREF="windows.html#window">window</A> of each <A HREF="intro.html#tab">tab</A> page.
When an error is detected on one <A HREF="intro.html#tab">tab</A> page, further <A HREF="intro.html#tab">tab</A> pages
will not be visited.
The last <A HREF="intro.html#tab">tab</A> page (or where an error occurred) becomes the
current <A HREF="intro.html#tab">tab</A> page.
{cmd} can contain '|' to concatenate several commands.
{cmd} must not open or close <A HREF="intro.html#tab">tab</A> pages or reorder them.
{not in Vi} {not available when compiled without the
|<A HREF="various.html#+listcmds">+listcmds</A>| feature}
Also see |<A HREF="windows.html#:windo">:windo</A>|, |<A HREF="editing.html#:argdo">:argdo</A>|, |<A HREF="windows.html#:bufdo">:bufdo</A>|, |<A HREF="quickfix.html#:cdo">:cdo</A>|, |<A HREF="quickfix.html#:ldo">:ldo</A>|, |<A HREF="quickfix.html#:cfdo">:cfdo</A>|
and |<A HREF="quickfix.html#:lfdo">:lfdo</A>|
==============================================================================
3. Other items *<A NAME="tab-page-other"></A><B>tab-page-other</B>*
*<A NAME="tabline-menu"></A><B>tabline-menu</B>*
The <A HREF="gui.html#GUI">GUI</A> <A HREF="intro.html#tab">tab</A> pages line has a popup menu. It is accessed with a right click.
The entries are:
Close Close the <A HREF="intro.html#tab">tab</A> page under the mouse pointer. The
current one if there is no label under the mouse
pointer.
New <A HREF="intro.html#Tab">Tab</A> Open a <A HREF="intro.html#tab">tab</A> page, editing an empty buffer. It appears
to the left of the mouse pointer.
Open Tab... Like "New Tab" and additionally use a file selector to
select a file to edit.
Diff mode works per <A HREF="intro.html#tab">tab</A> page. You can see the diffs between several files
within one <A HREF="intro.html#tab">tab</A> page. Other <A HREF="intro.html#tab">tab</A> pages can show differences between other
files.
Variables local to a tab page start with "<A HREF="eval.html#t:">t:</A>". |<A HREF="eval.html#tabpage-variable">tabpage-variable</A>|
Currently there is only one option local to a <A HREF="intro.html#tab">tab</A> page: <A HREF="options.html#'cmdheight'">'cmdheight'</A>.
*<A NAME="tabnew-autocmd"></A><B>tabnew-autocmd</B>*
The <A HREF="autocmd.html#TabLeave">TabLeave</A> and <A HREF="autocmd.html#TabEnter">TabEnter</A> <A HREF="autocmd.html#autocommand">autocommand</A> events can be used to <A HREF="diff.html#do">do</A> something when
switching from one <A HREF="intro.html#tab">tab</A> page to another. The exact order depends on what you
are doing. When creating a new <A HREF="intro.html#tab">tab</A> page this works <A HREF="motion.html#as">as</A> if you create a new
<A HREF="windows.html#window">window</A> on the same buffer and then edit another buffer. Thus "<A HREF="#:tabnew">:tabnew</A>"
triggers:
<A HREF="autocmd.html#WinLeave">WinLeave</A> leave current <A HREF="windows.html#window">window</A>
<A HREF="autocmd.html#TabLeave">TabLeave</A> leave current <A HREF="intro.html#tab">tab</A> page
<A HREF="autocmd.html#WinEnter">WinEnter</A> enter <A HREF="windows.html#window">window</A> in new <A HREF="intro.html#tab">tab</A> page
<A HREF="autocmd.html#TabEnter">TabEnter</A> enter new <A HREF="intro.html#tab">tab</A> page
<A HREF="autocmd.html#BufLeave">BufLeave</A> leave current buffer
<A HREF="autocmd.html#BufEnter">BufEnter</A> enter new empty buffer
When switching to another <A HREF="intro.html#tab">tab</A> page the order is:
<A HREF="autocmd.html#BufLeave">BufLeave</A>
<A HREF="autocmd.html#WinLeave">WinLeave</A>
<A HREF="autocmd.html#TabLeave">TabLeave</A>
<A HREF="autocmd.html#TabEnter">TabEnter</A>
<A HREF="autocmd.html#WinEnter">WinEnter</A>
<A HREF="autocmd.html#BufEnter">BufEnter</A>
==============================================================================
4. Setting <A HREF="options.html#'tabline'">'tabline'</A> *<A NAME="setting-tabline"></A><B>setting-tabline</B>*
The <A HREF="options.html#'tabline'">'tabline'</A> option specifies what the line with <A HREF="intro.html#tab">tab</A> pages labels looks like.
It is only used when there is no <A HREF="gui.html#GUI">GUI</A> <A HREF="intro.html#tab">tab</A> line.
You can use the <A HREF="options.html#'showtabline'">'showtabline'</A> option to specify when you want the line with
<A HREF="intro.html#tab">tab</A> page labels to appear: never, when there is more than one <A HREF="intro.html#tab">tab</A> page or
always.
The highlighting of the <A HREF="intro.html#tab">tab</A> pages line is set with the groups TabLine
TabLineSel and TabLineFill. |<A HREF="syntax.html#hl-TabLine">hl-TabLine</A>| |<A HREF="syntax.html#hl-TabLineSel">hl-TabLineSel</A>| |<A HREF="syntax.html#hl-TabLineFill">hl-TabLineFill</A>|
A "<A HREF="motion.html#+">+</A>" will be shown for a <A HREF="intro.html#tab">tab</A> page that has a modified <A HREF="windows.html#window">window</A>. The number of
<A HREF="windows.html#windows">windows</A> in a <A HREF="#tabpage">tabpage</A> is also shown. Thus "3+" means three <A HREF="windows.html#windows">windows</A> and one of
them has a modified buffer.
The <A HREF="options.html#'tabline'">'tabline'</A> option allows you to define your preferred way to <A HREF="intro.html#tab">tab</A> pages
labels. This isn't <A HREF="starting.html#easy">easy</A>, thus an example will be given here.
For basics see the <A HREF="options.html#'statusline'">'statusline'</A> option. The same items can be used in the
<A HREF="options.html#'tabline'">'tabline'</A> option. Additionally, the |<A HREF="eval.html#tabpagebuflist()">tabpagebuflist()</A>|, |<A HREF="eval.html#tabpagenr()">tabpagenr()</A>| and
|<A HREF="eval.html#tabpagewinnr()">tabpagewinnr()</A>| <A HREF="eval.html#functions">functions</A> are useful.
Since the number of <A HREF="intro.html#tab">tab</A> labels will vary, you need to use an <A HREF="eval.html#expression">expression</A> for
the whole option. Something like:
<B> :set tabline=%!MyTabLine()</B>
Then define the MyTabLine() function to <A HREF="eval.html#list">list</A> all the <A HREF="intro.html#tab">tab</A> pages labels. A
convenient method is to split <A HREF="motion.html#it">it</A> in two parts: First go over all the <A HREF="intro.html#tab">tab</A>
pages and define labels for them. Then get the label for each <A HREF="intro.html#tab">tab</A> page.
<B> function MyTabLine()</B>
<B> let s = ''</B>
<B> for i in range(tabpagenr('$'))</B>
<B> " select the highlighting</B>
<B> if i + 1 == tabpagenr()</B>
<B> let s .= '%#TabLineSel#'</B>
<B> else</B>
<B> let s .= '%#TabLine#'</B>
<B> endif</B>
<B> " set the tab page number (for mouse clicks)</B>
<B> let s .= '%' . (i + 1) . 'T'</B>
<B> " the label is made by MyTabLabel()</B>
<B> let s .= ' %{MyTabLabel(' . (i + 1) . ')} '</B>
<B> endfor</B>
<B> " after the last tab fill with TabLineFill and reset tab page nr</B>
<B> let s .= '%#TabLineFill#%T'</B>
<B> " right-align the label to close the current tab page</B>
<B> if tabpagenr('$') > 1</B>
<B> let s .= '%=%#TabLine#%999Xclose'</B>
<B> endif</B>
<B> return s</B>
<B> endfunction</B>
Now the MyTabLabel() function is called for each <A HREF="intro.html#tab">tab</A> page to get its label.
<B> function MyTabLabel(n)</B>
<B> let buflist = tabpagebuflist(a:n)</B>
<B> let winnr = tabpagewinnr(a:n)</B>
<B> return bufname(buflist[winnr - 1])</B>
<B> endfunction</B>
This is just a simplistic example that results in a <A HREF="intro.html#tab">tab</A> pages line that
resembles the default, but without adding a + for a modified buffer or
truncating the names. You will want to reduce the width of labels in a
clever way when there is not enough room. Check the <A HREF="options.html#'columns'">'columns'</A> option for the
space available.
==============================================================================
5. Setting <A HREF="options.html#'guitablabel'">'guitablabel'</A> *<A NAME="setting-guitablabel"></A><B>setting-guitablabel</B>*
When the <A HREF="gui.html#GUI">GUI</A> <A HREF="intro.html#tab">tab</A> pages line is displayed, <A HREF="options.html#'guitablabel'">'guitablabel'</A> can be used to
specify the label to display for each <A HREF="intro.html#tab">tab</A> page. Unlike <A HREF="options.html#'tabline'">'tabline'</A>, which
specifies the whole <A HREF="intro.html#tab">tab</A> pages line at once, <A HREF="options.html#'guitablabel'">'guitablabel'</A> is used for each
label separately.
<A HREF="options.html#'guitabtooltip'">'guitabtooltip'</A> is very similar and is used for the tooltip of the same label.
This only appears when the mouse pointer hovers over the label, thus <A HREF="motion.html#it">it</A>
usually is longer. Only supported on some systems though.
See the <A HREF="options.html#'statusline'">'statusline'</A> option for the format of the value.
The "%N" item can be used for the current <A HREF="intro.html#tab">tab</A> page number. The |<A HREF="eval.html#v:lnum">v:lnum</A>|
variable is also set to this number when the option is evaluated.
The items that use a file name refer to the current <A HREF="windows.html#window">window</A> of the <A HREF="intro.html#tab">tab</A> page.
Note that <A HREF="syntax.html#syntax">syntax</A> highlighting is not used for the option. The %T and %X
items are also ignored.
A simple example that puts the <A HREF="intro.html#tab">tab</A> page number and the buffer name in the
label:
<B> :set guitablabel=%N\ %f</B>
An example that resembles the default <A HREF="options.html#'guitablabel'">'guitablabel'</A>: Show the number of
<A HREF="windows.html#windows">windows</A> in the <A HREF="intro.html#tab">tab</A> page and a '<A HREF="motion.html#+">+</A>' if there is a modified buffer:
<B> function GuiTabLabel()</B>
<B> let label = ''</B>
<B> let bufnrlist = tabpagebuflist(v:lnum)</B>
<B> " Add '+' if one of the buffers in the tab page is modified</B>
<B> for bufnr in bufnrlist</B>
<B> if getbufvar(bufnr, "&modified")</B>
<B> let label = '+'</B>
<B> break</B>
<B> endif</B>
<B> endfor</B>
<B> " Append the number of windows in the tab page if more than one</B>
<B> let wincount = tabpagewinnr(v:lnum, '$')</B>
<B> if wincount > 1</B>
<B> let label .= wincount</B>
<B> endif</B>
<B> if label != ''</B>
<B> let label .= ' '</B>
<B> endif</B>
<B> " Append the buffer name</B>
<B> return label . bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])</B>
<B> endfunction</B>
<B> set guitablabel=%{GuiTabLabel()}</B>
Note that the function must be defined before setting the option, otherwise
you get an error message for the function not being known.
If you want to fall back to the default label, return an empty <A HREF="eval.html#string">string</A>.
If you want to show something specific for a <A HREF="intro.html#tab">tab</A> page, you might want to use a
<A HREF="intro.html#tab">tab</A> page local variable. |<A HREF="eval.html#t:var">t:var</A>|
<A HREF="#top">top</A> - <A HREF="index.html">main help file</A>
</PRE>
</BODY>
</HTML>
|