Bram Moolenaar | 7e8fd63 | 2006-02-18 22:14:51 +0000 | [diff] [blame^] | 1 | *tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 18 |
| 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
| 5 | |
| 6 | |
| 7 | Editing with windows in multuple tab pages. *tab-page* *tabpage* |
| 8 | |
| 9 | The commands which have been added to use multiple tab pages are explained |
| 10 | here. Additionally, there are explanations for commands that work differently |
| 11 | when used in combination with more than one tab page. |
| 12 | |
| 13 | 1. Introduction |tab-page-intro| |
| 14 | 2. Commands |tab-page-commands| |
| 15 | 3. 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 |
| 19 | at compile time} |
| 20 | |
| 21 | ============================================================================== |
| 22 | 1. Introduction *tab-page-intro* |
| 23 | |
| 24 | A tab page holds one or more windows. You can easily switch between tab |
| 25 | pages, so that you have several collections of windows to work on different |
| 26 | things. |
| 27 | |
| 28 | Usually you will see a list of labels at the top of the Vim window, one for |
| 29 | each tab page. With the mouse you can click on the label to jump to that tab |
| 30 | page. There are other ways to move between tab pages, see below. |
| 31 | |
| 32 | Most commands work only in the current tab page. That includes the |CTRL-W| |
| 33 | commands, |:windo|, |:all| and |:ball|. The commands that are aware of |
| 34 | other tab pages than the current one are mentioned below. |
| 35 | |
| 36 | Tabs are also a nice way to edit a buffer temporarily without changing the |
| 37 | current window layout. Open a new tab page, do whatever you want to do and |
| 38 | close the tab page. |
| 39 | |
| 40 | ============================================================================== |
| 41 | 2. Commands *tab-page-commands* |
| 42 | |
| 43 | OPENING A NEW TAB PAGE: |
| 44 | |
| 45 | When starting Vim "vim -p filename ..." opens each file argument in a separate |
| 46 | tab page (up to 10). |-p| |
| 47 | |
| 48 | :tabe[dit] *:tabe* *:tabedit* |
| 49 | :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 | |
| 55 | :tabf[ind] [++opt] [+cmd] {file} |
| 56 | 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 | |
| 62 | CLOSING A TAB PAGE: |
| 63 | |
| 64 | Using |:close| in the last window of a tab page closes it. |
| 65 | |
| 66 | Using the mouse: If the tab page line is displayed you can click in the "X" at |
| 67 | the 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 | |
| 93 | SWITCHING TO ANOTHER TAB PAGE: |
| 94 | |
| 95 | Using the mouse: If the tab page line is displayed you can click in a tab page |
| 96 | label to switch to that tab page. |'tabline'| |
| 97 | |
| 98 | :tab *:tab* *gt* |
| 99 | gt 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 | |
| 106 | Other commands: |
| 107 | *:tabs* |
| 108 | :tabs List the tab pages and the windows they contain. Shows a "+" |
| 109 | for modified buffers. |
| 110 | |
| 111 | ============================================================================== |
| 112 | 3. Other items *tab-page-other* |
| 113 | |
| 114 | You can use the 'tabline' option to specify when you want the line with tab |
| 115 | page labels to appear: never, when there is more than one tab page or always. |
| 116 | |
| 117 | Diff mode works per tab page. You can see the diffs between several files |
| 118 | within one tab page. Other tab pages can show differences between other |
| 119 | files. |
| 120 | |
| 121 | The TabLeavePre and TabEnterPost autocommand events can be used to do |
| 122 | something when switching from one tab page to another. |
| 123 | |
| 124 | |
| 125 | vim:tw=78:ts=8:ft=help:norl: |