某些键映射在MacVim中不起作用 [英] Certain key mappings not working in MacVim

查看:133
本文介绍了某些键映射在MacVim中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在工作时已改用Mac,而以前使用的是Linux.我发现了有关MacVim的信息(来自 http://code.google.com/p/macvim/),并一直尝试移植我以前的键盘映射.

I've recently switched to using a Mac at work from previously using Linux. I found out about MacVim (from http://code.google.com/p/macvim/) and have been trying to port over my previous keymappings.

我以前拥有的映射如下:

The mappings I used to have are as follows:

  • Ctrl-T :新标签页
  • Ctrl-W :关闭标签页/窗口
  • Ctrl-1 ... Ctrl-0 :切换至编号标签
  • Alt-Up :新标签页(与 Ctrl-T 相同)
  • 左/左/右/右:切换到上一个/下一个标签
  • Ctrl-Alt-E :以文件模式打开FuzzyFinder
  • Ctrl-Alt-B :以缓冲模式打开FuzzyFinder
  • Ctrl-Alt-W :清除缓冲区中的尾随空白
  • Ctrl-T: New tab
  • Ctrl-W: Close tab/window
  • Ctrl-1 ... Ctrl-0: Switch to numbered tab
  • Alt-Up: New tab (same as Ctrl-T)
  • Alt-Left/Alt-Right: Switch to the previous/next tab
  • Ctrl-Alt-E: Open FuzzyFinder in file mode
  • Ctrl-Alt-B: Open FuzzyFinder in buffer mode
  • Ctrl-Alt-W: Clear trailing whitespace from the buffer

现在,为了使这些映射更像"Mac一样",我决定将前两个切换为使用选项(即Apple徽标)键,而其他所有切换为使用命令键而不是Alt(即 Ctrl-Alt-E 变为 Ctrl-Command-E ).我在 http://macvim.org/OSX/index.php 上看到,该密钥可以是映射为D(即).我的.vimrc的新内容如下:

Now, to make these mappings more 'Mac like', I decided to switch the first two to use the option (ie. Apple logo) key, and all the others to use the command key instead of Alt (ie. Ctrl-Alt-E becomes Ctrl-Command-E). I read on http://macvim.org/OSX/index.php that this key can be mapped with D (ie ). The new contents of my .vimrc is as follows:

nmap <D-t> :tabnew<cr>
nmap <D-w> :close<cr>
nmap <D-1> 1gt
nmap <D-2> 2gt
nmap <D-3> 3gt
nmap <D-4> 4gt
nmap <D-5> 5gt
nmap <D-6> 6gt
nmap <D-7> 7gt
nmap <D-8> 8gt
nmap <D-9> 9gt
nmap <D-0> 10gt

nmap <D-Up> :tabnew<CR>
nmap <D-Right> :tabnext<CR>
nmap <D-Left> :tabprevious<CR>

"FuzzyFinder
nmap <C-D-e> :FufFileWithFullCwd<CR>
nmap <C-D-b> :FufBuffer<CR>

"Whitespace remover
nmap <C-D-w> :%s/\s\+$//<CR>

因此,在重新映射键之后,有些现在可以工作,而有些则不能,并且没有明确的原因.

So, after re-mapping the keys, some now work and others don't, with no clear logic as to why.

有效方法:

  • Cmd-T Cmd-W 成功用于打开和关闭选项卡.
  • Cmd-1 ... Cmd-0 成功地用于切换标签.
  • Cmd-T and Cmd-W successfully work for opening and closing tabs.
  • Cmd-1 ... Cmd-0 successfully work for switching tabs.

什么不起作用:

  • Cmd-Up 用于打开标签页不起作用.
  • 切换选项卡的
  • Cmd-Left Cmd-Right 无效.
  • 用于打开FuzzyFinder的
  • Ctrl-Cmd-E Ctrl-Cmd-B 不起作用.
  • Ctrl-Cmd-W 用于清除空格不起作用(但也不能关闭选项卡,就像没有 ctrl 一样.
  • Cmd-Up for opening a tab does not work.
  • Cmd-Left and Cmd-Right for switching tabs does not work.
  • Ctrl-Cmd-E and Ctrl-Cmd-B for opening FuzzyFinder do not work.
  • Ctrl-Cmd-W for clearing whitespace does not work (but neither does it close the tab, as it would without ctrl.

推荐答案

因此,事实证明Macvim中存在错误(http://code.google.com/p/macvim/issues/detail?id=317 ),这意味着无法映射ctrl键.相反,我映射了领导者键(也就是反斜杠),现在一切似乎都可以正常工作.

So it turns out that there is a bug in Macvim (http://code.google.com/p/macvim/issues/detail?id=317) which means it's not possible to map the ctrl key. Instead I mapped the leader key (a.k.a. the backslash), and it all seems to work now.

这篇关于某些键映射在MacVim中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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