开发者

MacVim: Any idea why I can't override the Command button?

I am trying to use the command button in MacVim instead of Ctrl开发者_开发问答 and other buttons.

I tried something like :imap <D-space> <Esc> to override the normal Command-space functionality while in MacVim but it still performs the spotlight.

Any ideas?


In these cases its usually the window manager intercepting the key-stroke before the application ever sees it. There may be an option to turn off certain global key-bindings when a specified app is active but I've been unable to find it on 10.5 - linux window managers have this functionality, as does windows, so I'd expect its hiding somewhere in the OS WM..


The Spotlight shortcut takes precedence over your own shortcut.

To be able to use it in MacVim you must change Spotlight's shortcut in its preferences.

However, the Command key won't work in Terminal.app and won't be sent to remote servers connected by SSH. If you use Vim on a server you won't be able to use it and you will be forced to either create and learn lots of machine-specific mappings or simply use the defaults.

Another possible issue, one I encountered at the beginning, is that shortcuts with multiple modifier keys (like <D-M-something> or <C-S-something>) don't work in MacVim.

Because of that and the number of native shortcuts using these keys you won't have many possibilities.

When I decided to learn Vim (with MacVim), I tried a lot of things to make it (and Vim) more "Mac-like" or "TextMate-like" to no avail.

Instead i suggest you to do things the Vim way. It may seem weird but it's worth it.

In your case, the "Vim way" would be to use mapleader, it's a regular key on your keyboard that is used for custom mappings. The default key is \, if you want to change it (to , for the example, that's my settings but YMMV), add this line to your ~/.vimrc:

let mapleader=","

After that you can create mappings like this:

inoremap <leader><Space> <ESC>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜