此处为老的 LinuxGem,新版 LinuxGem 请移步

Bufpos -- 用 Alt+n 切换 Vim 的标签

galeki posted @ 2009年1月25日 06:14 in 文档编辑与排版 with tags vim gvim tab , 7733 阅读

Gvim7 开始支持了标签,这样不需要安装插件,也可以实现多标签页编辑,不过默认状态下面,切换起来很麻烦。

大部分具有标签功能的程序,都支持 Alt+n 的方式来切换标签页,想要在 gvim 中使用,只要加一段 script 在 .vimrc 中:

function! BufPos_ActivateBuffer(num)
    let l:count = 1
    for i in range(1, bufnr("$"))
        if buflisted(i) && getbufvar(i, "&modifiable")
            if l:count == a:num
                exe "buffer " . i
            let l:count = l:count + 1
    echo "No buffer!"

function! BufPos_Initialize()
    for i in range(1, 9)
        exe "map <M-" . i . "> :call BufPos_ActivateBuffer(" . i . ")<CR>"
    exe "map <M-0> :call BufPos_ActivateBuffer(10)<CR>"

autocmd VimEnter * call BufPos_Initialize()

这样就可以让 gvim 支持 Alt+n 来切换标签页了。

你也可以直接下载这个 Bufpos 插件,并放在 ~/.vim/plugins 目录下:


灵活操作 Vim 中的 Tabs

来对一些 Tab 命令,做一些快捷的键盘映射。

shili 说:
2009年1月25日 23:57


学习笔记 说:
2009年4月18日 03:37


seo 说:
2021年10月31日 06:04

As a very satisfied customer not only with their products, but also their customer services, I’d definitely recommend this printing to my fellow colleagues.

SEO 说:
2022年3月12日 04:52

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! Leedon Green Brochure

SEO 说:
2022年4月10日 03:32

I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... najbolji brokeri u hrvatskoj

SEO 说:
2022年4月18日 00:29

You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! Ki Residences Balance Units

2022年6月12日 17:04

toner cartridges canada MVP Ink & Office is a one-stop online shop that provides the best Canadian-made print products. We provide printer inks, toner cartridges, ...

pac man google 说:
2022年6月27日 21:25

This article was written by a real thinking writer. I agree many of the with the solid points made by the writer. I’ll be back. pac man google

DDD 说:
2022年7月26日 19:49

Over 30 years experience in roofing repairs, new roof installations and guttering in and around London, Surrey, Guildford, Epsom and Shepperton. Roof repairs Guildford

2022年10月01日 21:01

when taking your watch for a repair, always look for a reputable and experienced watch repairman,

登录 *

loading captcha image...
or Ctrl+Enter