LinuxGem
此处为老的 LinuxGem,新版 LinuxGem 请移步 www.linuxgem.org

灵活操作 Vim 中的 Tabs

galeki posted @ 2007年11月17日 01:07 in 文档编辑与排版 with tags tabs vim , 5524 阅读

Vim 支持 Tabs,也就是标签页编辑,很爽~

操作标签页的基本命令如下:

  • :tabnew : 打开一个新的标签页。
  • :tabprevious : 回到上一个标签页。
  • :tabnext : 到下一个标签页。

但是每次新建或者切换标签,都要打上这么一长串的命令,实在是麻烦,我们可以在配置文件中设置一下快捷键,如下: 

:map  <F5> :tabprevious<CR>
:map  <F6> :tabnext<CR>
:map  ^T   :tabnew<CR>
:imap  <F5> <ESC>:tabprevious<CR>i
:imap  <F6> <ESC>:tabnext<CR>i
:imap  ^T  <ESC>:tabnew<CR>i

这样 F5 是向前,F6 是向后,Ctrl t 是打开新的标签页,在插入模式下,也管用~ 当然你可以把上面的设置换成你习惯的键位~

不过,打开新标签页,每次都打开一个空白的标签页,然后再去选择文件,似乎有点折腾,如果新打开的标签页中显示当前目录下的文件,可以从中选择,那就好了~

实现很简单,在 :tabnew 后面给出目录名就可以了,当前目录的话,是 .:

:map  <F5> :tabprevious<CR>
:map  <F6> :tabnext<CR>
:map  ^T   :tabnew .<CR>
:imap  <F5> <ESC>:tabprevious<CR>i
:imap  <F6> <ESC>:tabnext<CR>i
:imap  ^T  <ESC>:tabnew .<CR>i

你也可以把 '.'  替换成你常用的目录~

这样做个小的改动,标签页比原来方便了不少~

kofcom007 说:
2007年11月17日 04:02 Good! 收藏了,只有想不到,没有做不到
shellex 说:
2007年11月17日 15:02 总觉得vim的tab不如miniBufExplorer插件方便
galeki 说:
2007年11月18日 01:41 @shellex: 我尝试一下,看起来确实不错~
garcia 说:
2007年11月25日 22:29 :map ^T :tabnew .这里好像错了吧,应该是:map :tabnew .吧?
galeki 说:
2007年11月26日 03:27 应该是显示的问题,我是通过 C-v C-t 的方式输入的,在我的 vim 中就显示为 ^T,而且也正常工作 :)
UMAIR 说:
2021年3月04日 15:23

The Karnataka Board will release the Kar 2nd PUC Admit Card 2021 on its official website. The State Board will be releasing the Kar 2nd PUC Kar 1st & 2nd PUC Hall Ticket 2021 Admit Card 2021 in February. All the students who will be appearing for the Karnataka Class 12 examinations must download the same and secure it. They will be required to carry the same on each day of their examination.

UMAIR 说:
2021年3月08日 19:23

I'm going to read this. I'll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article seo packages

UMAIR 说:
2021年3月09日 18:39

checking through the net, Appreciation for being really thoughtful. The post contains really beneficial information. AFFORDABLE MONTHLY OFF-PAGE SEO PACKAGES

UMAIR 说:
2021年3月18日 20:16

The review of signnow.com that you've shared here is excellent, and I will share this review with my https://www.saliblog.com/signnow-com-review.html

daniyalabbas212@gami 说:
2021年5月10日 08:09

The students will be able to check their UP Board Result for Class 12 via SMS also. The UP Board 12th Result 2021 would comprise the student's roll number, name, subject-wise marks among other details. Around 25 lakh students will be able to check their UP Board Result 2021 Class 12 for the UP 12th examination which will be conducted in April and May 2021. As soon as the UP Board Result 2021 Uttar Pradesh 12th Result 2021 ​is announced, the official website might crash or not load due to heavy traffic, in such a case, students must not panic and wait patiently to check their UP MSP Results 2021 for Class 12.

JAMES 说:
2021年11月13日 00:18
 

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter