blob: b7cd51bd8617468632657127d5283f1c6e5eb146 [file] [log] [blame]
Bram Moolenaar2a0449d2006-02-20 21:27:21 +00001*tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 20
Bram Moolenaar7e8fd632006-02-18 22:14:51 +00002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
Bram Moolenaar2a0449d2006-02-20 21:27:21 +00007Editing with windows in multiple tab pages. *tab-page* *tabpage*
Bram Moolenaar7e8fd632006-02-18 22:14:51 +00008
9The commands which have been added to use multiple tab pages are explained
10here. Additionally, there are explanations for commands that work differently
11when used in combination with more than one tab page.
12
131. Introduction |tab-page-intro|
142. Commands |tab-page-commands|
153. Other items |tab-page-other|
16
17{Vi does not have any of these commands}
18{not able to use multiple tab pages when the |+windows| feature was disabled
19at compile time}
20
21==============================================================================
221. Introduction *tab-page-intro*
23
24A tab page holds one or more windows. You can easily switch between tab
25pages, so that you have several collections of windows to work on different
26things.
27
28Usually you will see a list of labels at the top of the Vim window, one for
29each tab page. With the mouse you can click on the label to jump to that tab
30page. There are other ways to move between tab pages, see below.
31
32Most commands work only in the current tab page. That includes the |CTRL-W|
33commands, |:windo|, |:all| and |:ball|. The commands that are aware of
34other tab pages than the current one are mentioned below.
35
36Tabs are also a nice way to edit a buffer temporarily without changing the
37current window layout. Open a new tab page, do whatever you want to do and
38close the tab page.
39
40==============================================================================
412. Commands *tab-page-commands*
42
43OPENING A NEW TAB PAGE:
44
45When starting Vim "vim -p filename ..." opens each file argument in a separate
46tab page (up to 10). |-p|
47
Bram Moolenaar2a0449d2006-02-20 21:27:21 +000048:tabe[dit] *:tabe* *:tabedit* *:tabn* *:tabnew*
Bram Moolenaar7e8fd632006-02-18 22:14:51 +000049:tabn[ew] Open a new tab page with an empty window.
50
51:tabe[dit] [++opt] [+cmd] {file}
52:tabn[ew] [++opt] [+cmd] {file}
53 Open a new tab page and edit {file}, like with |:edit|.
54
Bram Moolenaar2a0449d2006-02-20 21:27:21 +000055:tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind*
Bram Moolenaar7e8fd632006-02-18 22:14:51 +000056 Open a new tab page and edit {file} in 'path', like with
57 |:find|.
58 {not available when the |+file_in_path| feature was disabled
59 at compile time}
60
61
62CLOSING A TAB PAGE:
63
64Using |:close| in the last window of a tab page closes it.
65
66Using the mouse: If the tab page line is displayed you can click in the "X" at
67the top right to close the current tab page. |'tabline'|
68
69 *:tabc* *:tabclose*
70:tabc[lose][!] Close current tab page.
71 This command fails when:
72 - There is only one tab page on the screen. *E784*
73 - When 'hidden' is not set, [!] is not used, a buffer has
74 changes, and there is no other window on this buffer.
75 Changes to the buffer are not written and won't get lost, so
76 this is a "safe" command.
77
78:tabc[lose][!] {count}
79 Close tab page {count}. Fails in the same way as ':tabclose"
80 above.
81
82 *:tabo* *:tabonly*
83:tabo[nly][!] Close all other tab pages.
84 When the 'hidden' option is set, all buffers in closed windows
85 become hidden.
86 When 'hidden' is not set, and the 'autowrite' option is set,
87 modified buffers are written. Otherwise, windows that have
88 buffers that are modified are not removed, unless the [!] is
89 given, then they become hidden. But modified buffers are
90 never abandoned, so changes cannot get lost.
91
92
93SWITCHING TO ANOTHER TAB PAGE:
94
95Using the mouse: If the tab page line is displayed you can click in a tab page
96label to switch to that tab page. |'tabline'|
97
98:tab *:tab* *gt*
99gt Go to the next tab page. Wraps around from the last to the
100 first one.
101
102:tab {count}
103{count}gt Go to tab page {count}. The first tab page has number one.
104
105
106Other commands:
107 *:tabs*
108:tabs List the tab pages and the windows they contain. Shows a "+"
109 for modified buffers.
110
111==============================================================================
1123. Other items *tab-page-other*
113
114You can use the 'tabline' option to specify when you want the line with tab
115page labels to appear: never, when there is more than one tab page or always.
116
Bram Moolenaar2a0449d2006-02-20 21:27:21 +0000117The highlighting of the tab pages line is set with the groups TabLine
118TabLineSel and TabLineFill. |hl-TabLine| |hl-TabLineSel| |hl-TabLineFill|
119
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000120Diff mode works per tab page. You can see the diffs between several files
121within one tab page. Other tab pages can show differences between other
122files.
123
Bram Moolenaar2a0449d2006-02-20 21:27:21 +0000124The TabLeave and TabEnter autocommand events can be used to do something when
125switching from one tab page to another. The exact order depends on what you
126are doing. When creating a new tab page this works as if you create a new
127window on the same buffer and then edit another buffer. Thus ":tabnew"
128triggers:
129 WinLeave leave current window
130 TabLeave leave current tab page
131 TabEnter enter new tab page
132 WinEnter enter window in new tab page
133 BufLeave leave current buffer
134 BufEnter enter new empty buffer
135
136For switching to another tab page the order is:
137 BufLeave
138 WinLeave
139 TabLeave
140 TabEnter
141 WinEnter
142 BufEnter
Bram Moolenaar7e8fd632006-02-18 22:14:51 +0000143
144
145 vim:tw=78:ts=8:ft=help:norl: