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

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

问题描述

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

我已经在Windows XP中将其用于gVim,但在Ubuntu 9.10中将其移至我的.vimrc中,但它不起作用(vim 7.2).

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

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

<C-t>可以正常工作,因此映射ctrl键似乎不是问题.我真的不知道从哪里开始!考虑到它在Windows下可以正常工作,这里可能出什么问题了?

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

Ctrl-tab映射在fluxbox中起作用:我可以在窗口管理器中成功映射ctrl-tab和ctrl-shift-tab;如果我开始对xterms进行制表,则可以按预期浏览这些制表符.我不确定这是什么意思,但是我认为问题不是窗口管理器/xorg问题.

这些键似乎没有映射到其他东西,并且可以成功地一起识别.

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

解决方案

这绝对是终端问题.

显然,xterm和许多其他终端仿真器默认情况下不拦截ctrl-tab,而只是发送一个tab信号.该 Vim Wiki页面指出ctrl-tab不适用于xterm,Eterm和aterm.还有 Arch linux表单帖子声称这是终端问题.

解决方案可以通过组合用于映射键码的vim Wiki .其要点是,您需要配置xterm以拦截并发送.Xresources文件中ctrl-tab和ctrl-shift-tab的唯一代码,然后通过一些时髦的映射将其入侵到.vimrc中.

长话短说,因为xterm和vim都需要欺骗才能做到,所以很难做到(仍然无法在这里工作).我个人将继续使用其他映射...这个问题是一个严重的时间问题,我认为继续进行下去并不值得!

感谢帮助人员.

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

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).

Here's the relevant section of my .vimrc:

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

<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?

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 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.

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.

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.

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.

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!

Thanks for the help guys.

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

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