切换到VIM中的特定选项卡

我试图从一个标签切换到VIM中的另一个标签(它可能与前一个标签不相邻)。 有没有什么捷径,就像我们有Ctrlp / Ctrln切换到相邻的标签?

另外,我试图编写一个键映射,它会给一个variables作为一个函数的input并执行操作。 例如,假设我按Ctrl5 ,一个函数(由用户编写)将被调用,并作为input5给出,光标将进入选项卡5(如果有任何第五个选项卡打开)。

你能build议如何做到这一点?

使用5gt切换到标签5

:tabn [ext] {count}

{计数} GT

转到标签页{count}。 第一个标签页有第一个。

你也可以将它绑定到一个键:

 :map <C-5> 5gt :imap <C-5> <CO>5gt 

(对于某些terminal,映射Ctrl-<number>可能是不同的/不可能的,那么考虑Alt-<number>

只处理你的第一个问题,并引用vim中的help tabs

 {count}gt Go to tab page {count}. The first tab page has number one. {count}gT Go {count} tab pages back. Wraps around from the first one to the last one. 

即键入3gt转到第三个标签, 3gT从当前标签返回3个标签。

只是为了共享键映射直接跳转到特定的选项卡。 请把它们放到_vimrc中并使其工作。

 " Jump to particular tab directly "NORMAL mode bindings for gvim noremap <unique> <M-1> 1gt noremap <unique> <M-2> 2gt noremap <unique> <M-3> 3gt noremap <unique> <M-4> 4gt noremap <unique> <M-5> 5gt noremap <unique> <M-6> 6gt noremap <unique> <M-7> 7gt noremap <unique> <M-8> 8gt noremap <unique> <M-9> 9gt noremap <unique> <M-0> 10gt "INSERT mode bindings for gvim inoremap <unique> <M-1> <CO>1gt inoremap <unique> <M-2> <CO>2gt inoremap <unique> <M-3> <CO>3gt inoremap <unique> <M-4> <CO>4gt inoremap <unique> <M-5> <CO>5gt inoremap <unique> <M-6> <CO>6gt inoremap <unique> <M-7> <CO>7gt inoremap <unique> <M-8> <CO>8gt inoremap <unique> <M-9> <CO>9gt inoremap <unique> <M-0> <CO>10gt