Is there any way to disable keyboard shortcuts in MacVim? I mean the shortcuts like Cmd + s
for example, I want to convince myself to use things like :w
, but I can't do so if I can save the file using Cmd + s
, you get me?
But I of course, still want to use the GUI, so is there any way to disable these, without stoping using the MacVim GUI?
Thanks for your help. BTW I made a Google search and wasn't able to find an answer.
EDIT:
Following @ChrisJohnsen's suggestion, I have already tried the following with no success:
if has('gui_running')
macmenu File.Save key=<nop>
macmenu File.Save\ As\.\.\. key=<nop>
endif
EDIT 2:
I moved the error I'm getting over to this other question: When I try to run vim in command line I get Python errors
Select “Keyboard” from the list on the left side of your screen. Click on “Shortcuts” in the list of settings across the top of the window. Once inside “Shortcuts,” uncheck the box next to each shortcut to disable it.
Find the shortcut you're trying to disable, click on it to set a new shortcut, then pressing Backspace will disable that shortcut.
Some other cool Vim search tips/tricks To start off, if you want to search for a word that's there in the file, but you don't want to type it, you can just bring your cursor below it and press * (or shift+8).
There is no simple way to disable all of the pre-defined Mac-style keyboard shortcuts, but you can definitely change/disable any of them. The important command is :macmenu
(see :help :macmenu
); it lets you set the Mac-specific properties of any Vim menu item (mostly Mac-specific keyboard shortcuts and Mac-specific actions (e.g. open/save dialog boxes, window manipulations, etc.)).
macmenu File.Save key=<nop>
macmenu File.Save\ All key=<nop>
macmenu File.Save\ As\.\.\. key=<nop>
The thing is that :macmenu
commands are only effective if they are in your .gvimrc
file.
If you do :e $VIMRUNTIME/menu.vim
and search for macm
, you will find the list of pre-defined shortcuts and actions. Copy the desired lines to you .gvimrc
and replace key=<whatever>
with key=<nop>
. You can also wrap them in if has("gui_macvim")
/ endif
if you need your .gvimrc
to work on multiple platforms.
MacVim has only one "advantage" over plain Vim: it supports native Mac OS X shortcuts. If you don't want those shortcuts you might as well simply use plain Vim.
FWIW, when I switched from TextMate I, too, found after a while that these native shortcuts were an obstacle on my way to learning Vim. My solution was to focus my efforts on plain Vim. After a week in the terminal you should be able to completely disregard those shortcuts.
I'd advise you to take a little pause and think about doing things in a more appropriate order:
In the terminal, do $ vimtutor
as many times as needed.
In the terminal again, use $ vim
for simple tasks first then more complex tasks. There's a predictable productivity hit at the beginning but it will last only a few days/weeks.
Once you have reached your previous level of productivity, you can start to fly Vim full-time. At that point, using MacVim or GVim or plain $ vim
should make no difference whatsoever.
Bonus points for not relying too much on plugins, other people's vimrcs or "distributions" like janus or spf13…
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With