我最近在工作中从之前使用 Linux 转向使用 Mac。我发现了 MacVim(来自http://code.google.com/p/macvim/)并一直在尝试移植我以前的键盘映射。
我以前的映射如下:
-
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
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>
因此,在重新映射按键后,有些按键可以工作,而另一些则不能,没有明确的逻辑说明原因。
什么有效:
-
Cmd-T and Cmd-W successfully work for opening and closing tabs.
-
Cmd-1 ... Cmd-0 successfully work for switching tabs.
什么不起作用:
-
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.
通过执行以下操作来调查原因
:verbose map <D-Up>
另外尝试有选择地启用其他插件以查看映射是否以某种方式被清除
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)