8

On OS X, at any program, when I type option-p I get π, option-P I get and there's a bunch of alt/option bindings that just return greek and other special characters.

Is there a way to disable that?

Currently I'm using the Auto Pairs VIM plugin and it has the following default mappings:

<M-p> : Toggle Autopairs (g:AutoPairsShortcutToggle) 
<M-e> : Fast Wrap (g:AutoPairsShortcutFastWrap) 
<M-n> : Jump to next closed pair (g:AutoPairsShortcutJump) 
<M-b> : BackInsert (g:AutoPairsShortcutBackInsert)

It seems I can't use these and other meta key based VIM mappings while this special input is turned on.

EDIT

From this cnet article, in truth I need to know how to disable that special input shown at the bottom of the page.

oblitum
  • 11,380
  • 6
  • 54
  • 120

2 Answers2

14

Use the macmeta setting: :set macmeta

From :help 'macmeta'

'macmeta' Use option (alt) as meta key. When on, option-key presses are not interpreted, thus enabling bindings to <M-..>. When off, option-key presses are interpreted by the selected input method and inserted as text.

Obviously this is a MacVim-only setting.

In Terminal.app Settings there's a setting for "Use option as meta key", under the Keyboard tab which disables e.g. Option-p printing π. You may need to start a new terminal window to see the effect. But for some reason even after disabling this I'm having trouble setting mappings for <M-p>, but mappings using Ctrl-v and inserting the character literally do work.

pb2q
  • 58,613
  • 19
  • 146
  • 147
  • 3
    The only caveat is that it is {only available in MacVim GUI} =(. I would like to know how to turn it off system wide. – oblitum Aug 10 '12 at 15:13
4

Well, it seems that with MacVim, in my .vimrc I can just map these special characters and it will work both at GUI and at Terminal.

Since they are generated by the corresponding meta key combinations, it'll look just as a meta key mapping.

EDIT

Some special characters are accents and it may not work well for them.

I've done this at my .vimrc:

if has("gui_macvim")
  let g:AutoPairsShortcutToggle     = 'π' " <m-p>
  let g:AutoPairsShortcutFastWrap   = '∑' " <m-w>
  let g:AutoPairsShortcutJump       = '∆' " <m-j>
  let g:AutoPairsShortcutBackInsert = '∫' " <m-b>
endif

has("gui_macvim") is true both at GUI as at Terminal, when running MacVim.

oblitum
  • 11,380
  • 6
  • 54
  • 120