|
5 | 5 | <link href="https://learnbyexample.github.io/atom.xml" rel="self" type="application/atom+xml"/>
|
6 | 6 | <link href="https://learnbyexample.github.io"/>
|
7 | 7 | <generator uri="https://www.getzola.org/">Zola</generator>
|
8 |
| - <updated>2023-01-31T00:00:00+00:00</updated> |
| 8 | + <updated>2023-02-01T00:00:00+00:00</updated> |
9 | 9 | <id>https://learnbyexample.github.io/atom.xml</id>
|
| 10 | + <entry xml:lang="en"> |
| 11 | + <title>Vim tip 21: working with tabs</title> |
| 12 | + <published>2023-02-01T00:00:00+00:00</published> |
| 13 | + <updated>2023-02-01T00:00:00+00:00</updated> |
| 14 | + <link rel="alternate" href="https://learnbyexample.github.io/tips/vim-tip-21/" type="text/html"/> |
| 15 | + <id>https://learnbyexample.github.io/tips/vim-tip-21/</id> |
| 16 | + <content type="html"><p>Multiple files can be opened in Vim within the same tab page and/or in different tabs. From <a href="https://vimhelp.org/windows.txt.html#windows-intro">:h windows-intro</a>:</p> |
| 17 | +<blockquote> |
| 18 | +<ul> |
| 19 | +<li>A buffer is the in-memory text of a file.</li> |
| 20 | +<li>A window is a viewport on a buffer.</li> |
| 21 | +<li>A tab page is a collection of windows.</li> |
| 22 | +</ul> |
| 23 | +</blockquote> |
| 24 | +<ul> |
| 25 | +<li><kbd>:tabe filename</kbd> open the given file in a new tab (<code>:tabe</code> is short for <code>:tabedit</code>) |
| 26 | +<ul> |
| 27 | +<li>if <code>filename</code> isn't specified, you'll get an unnamed empty window</li> |
| 28 | +<li>by default, the new tab is opened to the right of the current tab</li> |
| 29 | +<li><kbd>:0tabe</kbd> open as the first tab</li> |
| 30 | +<li><kbd>:$tabe</kbd> open as the last tab</li> |
| 31 | +<li>see <a href="https://vimhelp.org/tabpage.txt.html#%3Atabnew">:h :tabe</a> for more details and features</li> |
| 32 | +</ul> |
| 33 | +</li> |
| 34 | +</ul> |
| 35 | +<p>Switching between tabs:</p> |
| 36 | +<ul> |
| 37 | +<li><kbd>:tabn</kbd> switch to the next tab (<code>:tabn</code> is short for <code>:tabnext</code>) |
| 38 | +<ul> |
| 39 | +<li>if tabs to the right are exhausted, switch to the first tab</li> |
| 40 | +<li><kbd>gt</kbd> and <kbd>Ctrl</kbd>+<kbd>Page Down</kbd> can also be used</li> |
| 41 | +<li><kbd>2gt</kbd> switch to the second tab (the number specified is absolute, not relative)</li> |
| 42 | +</ul> |
| 43 | +</li> |
| 44 | +<li><kbd>:tabp</kbd> switch to the previous tab (<code>:tabp</code> is short for <code>:tabprevious</code>) |
| 45 | +<ul> |
| 46 | +<li>if tabs to the left are exhausted, switch to the last tab</li> |
| 47 | +<li><kbd>gT</kbd> and <kbd>Ctrl</kbd>+<kbd>Page Up</kbd> can also be used</li> |
| 48 | +</ul> |
| 49 | +</li> |
| 50 | +<li><kbd>:tabr</kbd> switch to the first tab (<code>:tabr</code> is short for <code>:tabrewind</code>) |
| 51 | +<ul> |
| 52 | +<li><kbd>:tabfirst</kbd> can also be used</li> |
| 53 | +</ul> |
| 54 | +</li> |
| 55 | +<li><kbd>:tabl</kbd> switch to the last tab (<code>:tabl</code> is short for <code>:tablast</code>)</li> |
| 56 | +</ul> |
| 57 | +<p>Moving tabs:</p> |
| 58 | +<ul> |
| 59 | +<li><kbd>:tabm N</kbd> move the current tab to after <code>N</code> tabs from the start (<code>:tabm</code> is short for <code>:tabmove</code>) |
| 60 | +<ul> |
| 61 | +<li><kbd>:tabm 0</kbd> move the current tab to the beginning</li> |
| 62 | +<li><kbd>:tabm</kbd> move the current tab to the end</li> |
| 63 | +</ul> |
| 64 | +</li> |
| 65 | +<li><kbd>:tabm +N</kbd> move the current tab <code>N</code> positions to the right</li> |
| 66 | +<li><kbd>:tabm -N</kbd> move the current tab <code>N</code> positions to the left</li> |
| 67 | +</ul> |
| 68 | +<p><img src="/images/info.svg" alt="info" /> Buffer list includes all the files opened in all the tabs. You can also use the mouse to switch/move tabs in GVim.</p> |
| 69 | +<p><strong>Video demo</strong>:</p> |
| 70 | +<p align="center"><iframe width="560" height="315" loading="lazy" src="https://www.youtube.com/embed/pQpWrrrYVTI" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></p> |
| 71 | +<br> |
| 72 | +<p><img src="/images/info.svg" alt="info" /> See also my <a href="https://github.com/learnbyexample/vim_reference">Vim Reference Guide</a> and <a href="https://learnbyexample.github.io/curated_resources/vim.html">curated list of resources for Vim</a>.</p> |
| 73 | +</content> |
| 74 | + </entry> |
10 | 75 | <entry xml:lang="en">
|
11 | 76 | <title>Understanding Python re(gex)? book announcement</title>
|
12 | 77 | <published>2023-01-30T00:00:00+00:00</published>
|
|
0 commit comments