映射<C-Tab>在我的 vimrc 中在 Ubuntu 中失败 [英] Mapping <C-Tab> in my vimrc fails in Ubuntu

查看:11
本文介绍了映射<C-Tab>在我的 vimrc 中在 Ubuntu 中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 ctrl-tab 映射到 :tabn,并将 ctrl-shift-tab 映射到 :tabp.

I want to map ctrl-tab to :tabn, and ctrl-shift-tab to :tabp.

我让它在 Windows XP 中为 gVim 工作,但在 Ubuntu 9.10 中将它移动到我的 .vimrc 并且它不起作用(vim 7.2).

I had it working for gVim in Windows XP, but moved it to my .vimrc in Ubuntu 9.10 and it doesn't work (vim 7.2).

这是我的 .vimrc 的相关部分:

Here's the relevant section of my .vimrc:

nmap <C-Tab> :tabn<CR>
nmap <C-S-Tab> :tabp<CR>
nmap <C-t> :tabnew<CR>

工作正常,所以映射 ctrl 键似乎不是问题.我真的不知道从哪里开始!考虑到它在 Windows 下运行良好,这里可能出了什么问题?

<C-t> works fine, so mapping the ctrl key doesn't seem to be a problem. I really have no idea where to start! What could be going wrong here, considering it worked fine under Windows?

更多信息:我正在运行 Ubuntu 9.10 服务器,xorgfluxbox 安装在顶部.我使用 xterm 作为我的终端.

More info: I'm running Ubuntu 9.10 server, with xorg and fluxbox installed on top. I'm using xterm as my terminal.

Ctrl-tab 映射在fluxbox 中有效:可以 在我的窗口管理器中成功映射ctrl-tab 和ctrl-shift-tab;如果我开始标记我的 xterm,我可以按预期循环浏览这些选项卡.我不确定这意味着什么,但我认为问题不是窗口管理器/xorg 问题.

Ctrl-tab mapping works in fluxbox: I can map ctrl-tab and ctrl-shift-tab successfully in my window manager; if I start tabbing my xterms, I can cycle through those tabs as expected. I'm not sure what this means, but I think the issue is not a window manager/xorg issue.

按键好像没有映射到别的东西上,可以一起成功识别.

The keys don't seem to be mapped to something else, and can be recognised together successfully.

答案:这是一个 xterm 问题 - 它不会拦截并发送 ctrl-tab 的唯一键码.有关详细信息,请参阅下面的完整答案.

Answer: It's an xterm issue - it doesn't intercept and send a unique keycode for ctrl-tab. See my full answer below for details.

推荐答案

这绝对是一个终端问题.

It's definitely a terminal issue.

显然,xterm 和许多其他终端模拟器默认情况下不会拦截 ctrl-tab,而只是发送一个 tab 信号.这个 Vim wiki 页面指出 ctrl-tab 不适用于 xterm、Eterm 和 aterm.还有这个 Arch linux form post 声称这是一个终端问题.

Apparently xterm, and lots of other terminal emulators, don't intercept ctrl-tab by default and just send a tab signal. This Vim wiki page states that ctrl-tab doesn't work for xterm, Eterm, and aterm. There's also this Arch linux form post claiming that it's a terminal issue.

解决方案可以通过结合这篇博文 带有这个 vim wiki 用于映射键码.它的要点是您需要配置 xterm 来拦截并发送 .Xresources 文件中 ctrl-tab 和 ctrl-shift-tab 的唯一代码,然后将其破解到您的 中.vimrc 带有一些时髦的映射.

The solution can be found by combining the info from this blog post with this vim wiki for mapping keycodes. This gist of it is that you need to configure xterm to intercept and send a unique code for ctrl-tab and ctrl-shift-tab in your .Xresources file, then hack that into your .vimrc with some funky mappings.

长话短说,这很难做到(这里还没有让它工作),因为 xterm 和 vim 都需要被欺骗才能做到.我个人会继续前进并使用另一个映射……这个问题是一个严重的时间问题,我认为不值得努力让它工作!

Long story short is that it's hard to do (still haven't got it working here) because xterm and vim both need to be tricked into doing it. I'm personally gonna move on and use another mapping... this issue is a serious time sucker and I don't think it's worth pressing on to get it working!

感谢大家的帮助.

这篇关于映射&lt;C-Tab&gt;在我的 vimrc 中在 Ubuntu 中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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