切换到 VIM 中的特定选项卡 [英] Switching to a particular tab in VIM

查看:43
本文介绍了切换到 VIM 中的特定选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 VIM 中从一个选项卡切换到另一个选项卡(可能与前一个选项卡不相邻).是否有任何快捷方式,例如我们有 Ctrl-p/Ctrl-n 用于切换到相邻选项卡?

I was trying to switch from a tab to another tab (which may not be adjacent to the previous tab) in VIM. Is there any shortcut for that, like we have Ctrl-p/Ctrl-n for switching to adjacent tabs?

此外,我试图编写一个键映射,它将变量作为函数的输入并执行操作.例如,假设我按下 Ctrl-5 并且一个函数(由用户编写)将被调用并作为输入 5 给出,光标将转到选项卡 5(如果打开了第 5 个标签).

Also, I was trying to write a key mapping which will give a variable as input to a function and do the operation. For instance, let's say I press Ctrl-5 and a function (written by the user) will be called and given as input 5, and the cursor will go to tab 5 (if there is any 5th tab opened).

你能建议如何做到这一点吗?

Can you please suggest how this can be done?

推荐答案

使用5gt切换到tab 5

:tabn[ext] {count}

:tabn[ext] {count}

{count}gt

转到标签页 {count}.第一个标签页排名第一.

Go to tab page {count}. The first tab page has number one.

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

you can also bind it to a key:

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

(映射 Ctrl- 对某些终端可能不同/不可能.然后考虑 Alt-)

(Mapping Ctrl-<number> could be different/impossible for some terminals. Consider Alt-<number> then)

这篇关于切换到 VIM 中的特定选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆