用户工具

站点工具


linux:vim:tabs

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

linux:vim:tabs [2010/06/02 01:18]
linux:vim:tabs [2010/06/02 01:18] (当前版本)
行 1: 行 1:
 +====== VIM 标签页 (tab) ======
 +
 +<​html>​
 +<p style="​font-weight:​ bold;">​新建标签页</​p><​p>​使用<​code class="​inset">:​tabe</​code>​命令和文件名参数,可以在新标签页中打开指定的文件。也可以使用<​code class="​inset">:​tabnew</​code>​命令,在新标签页中编辑新的文件。命令<​code class="​inset">:​tab split</​code>​将在新标签页中,打开当前缓冲区中的文件。</​p><​p>​命令<​code class="​inset">:​tabf</​code>​允许你在当前目录搜索文件,并在新标签页中打开。比如我想打开当前目录下的img.txt文件,那么就可以使用<​code class="​inset">:​tabf img.*</​code>​命令。请注意,此命令只能打开一个文件,如果搜索出多个匹配文件,将提示你“文件名过多”,这时你需要给出更精确的搜索条件以打开文件。</​p><​p>​Vim默认最多只能打开10个标签页。你可以用<​code class="​inset">​set tabpagemax=15</​code>​改变这个限制。</​p><​p>​ <img src="​http://​farm1.static.flickr.com/​147/​390976092_4b98eadb08_o.png"​ alt="​Tabs_new"​ height="​118"​ width="​414">​ </​p><​p style="​font-weight:​ bold;">​列示标签页</​p><​p>​命令<​code class="​inset">:​tabs</​code>​可以显示已打开标签页的列表,并用“&​gt;​”标识出当前页面,用“+”标识出已更改的页面。</​p><​p>​ <img src="​http://​farm1.static.flickr.com/​174/​390976091_f2ce87f68b_o.png"​ alt="​Tabs_list"​ height="​129"​ width="​412">​ </​p><​p style="​font-weight:​ bold;">​关闭标签页</​p><​p>​命令<​code class="​inset">:​tabc</​code>​可以关闭当前标签页。而命令<​code class="​inset">:​tabo</​code>​将关闭所有的标签页。</​p><​p style="​font-weight:​ bold;">​切换标签页</​p><​p>​命令<​code class="​inset">:​tabn</​code>​或<​code class="​inset">​gt</​code>​可以移动到下一个标签页。而命令<​code class="​inset">:​tabp</​code>​或<​code class="​inset">​gT</​code>​将移动到上一个标签页。如果已经到达最后面或最前面的标签页,将会自动转向循环。</​p><​p>​ <img src="​http://​farm4.static.flickr.com/​3308/​3442899619_8d07f51e32_o.png"​ alt="​Tabs_gt_gT"​ height="​137"​ width="​407">​ </​p><​p>​如果你打开了很多标签页,那么可以使用<​code class="​inset">:​tabfirst</​code>​或<​code class="​inset">:​tabr</​code>​命令,移动到第一个标签页。使用<​code class="​inset">:​tablast</​code>​命令,移动到最后一个标签页。</​p><​p style="​font-weight:​ bold;">​移动标签页</​p><​p>​如果你希望按照指定的次序排列标签页,那么你可以使用<​code class="​inset">:​tabm</​code>​命令。请注意,标签页次序是从0开始计数的。比如命令<​code class="​inset">:​tabm 1</​code>​将把当前标签页移动到第2的位置。如果你没有为<​code class="​inset">:​tabm</​code>​命令指定参数,那么当前标签页将会被移动到最后。</​p><​p style="​font-weight:​ bold;">​配置标签页</​p><​p>​默认情况下,只有用户新建了标签页才会在窗口上方显示标签栏,这是由选项<​code class="​inset">​set showtabline=1</​code>​决定的。如果我们希望总是显示标签栏,那么可以用<​code class="​inset">​set showtabline=2</​code>​命令来设置。如果我们希望完全不显示标签栏,那么可以使用<​code class="​inset">​set showtabline=0</​code>​来设置。</​p><​p style="​font-weight:​ bold;">​多标签页命令</​p><​p>​使用<​code class="​inset">:​tabdo</​code>​命令,我们可以同时在多个标签页中执行命令。比如我们打开了多个标签页,需要把这些文件中的“food”都替换成“drink”,那么就可以使用<​code class="​inset">:​tabdo %s/​food/​drink/​g</​code>​命令,一次完成对所有文件的替换操作,而不用针对每个文件重复操作。</​p><​p style="​font-weight:​ bold;">​图形界面</​p><​p>​如果你使用的是带有图形界面的gVim,那么新建、关闭和打开标签页的操作,都可以通过在标签页上右击鼠标完成。只需要点击相应标签,就可以在不同的标签页间切换。</​p><​p>​通过<​code class="​inset">:​help tab-page-intro</​code>​命令,可以获得关于标签页使用的更多信息。</​p><​table summary="​Commands"​ border="​2"​ cellpadding="​3"​ cellspacing="​0"​ frame="​hsides"​ rules="​all"><​caption>​命令小结</​caption><​tbody><​tr><​td><​code class="​inset">:​tabnew</​code></​td><​td>​新建标签页</​td></​tr><​tr><​td><​code class="​inset">:​tabs</​code></​td><​td>​显示已打开标签页的列表</​td></​tr><​tr><​td><​code class="​inset">:​tabc</​code></​td><​td>​关闭当前标签页</​td></​tr><​tr><​td><​code class="​inset">:​tabn</​code></​td><​td>​移动到下一个标签页</​td></​tr><​tr><​td><​code class="​inset">:​tabp</​code></​td><​td>​移动到上一个标签页</​td></​tr><​tr><​td><​code class="​inset">:​tabfirst</​code></​td><​td>​移动到第一个标签页</​td></​tr><​tr><​td><​code class="​inset">:​tablast</​code></​td><​td>​移动到最后一个标签页</​td></​tr></​tbody></​table>​
 +</​html>​
  
linux/vim/tabs.txt · 最后更改: 2010/06/02 01:18 (外部编辑)