Hello,

with MacVim, the "macmeta" currently allows to use both "Option" keys
either as "Meta" or "AltGr". Like a lot of European users, I'd prefer
the "macmeta" pref to set only one "Option" key as "Meta" (e.g. the
left one, as it works on Windows and GNU/Linux) and keep the other one
for special characters on non-English keyboard layouts.

In case someone is interested if having both a Meta key *and* an
Option key when "macmeta" is set, here's a quick and dirty patch:

 diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/
MMTextViewHelper.m
 index 4d10432..42f311b 100644
 --- a/src/MacVim/MMTextViewHelper.m
 +++ b/src/MacVim/MMTextViewHelper.m
 @@ -22,6 +22,9 @@
 #import "MMWindowController.h"
 #import "Miscellaneous.h"

 +// asymetric meta keys
 +#define NSLeftAlternateKeyMask  (0x000020 | NSAlternateKeyMask)
 +#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask)

 // The max/min drag timer interval in seconds
 static NSTimeInterval MMDragTimerMaxInterval = 0.3;
 @@ -165,7 +168,8 @@ KeyboardInputSourcesEqual(TISInputSourceRef
a,TISInputSourceRef b)
     // ASCII chars in the range after space (0x20) and before
backspace (0x7f).
     // Note that this implies that 'mmta' (if enabled) breaks input
methods
     // when the Alt key is held.
 -    if ((flags & NSAlternateKeyMask) && [mmta boolValue] && [unmod
length] == 1
 +    if (((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask)
 +            && [mmta boolValue] && [unmod length] == 1
             && [unmod characterAtIndex:0] > 0x20
             && [unmod characterAtIndex:0] < 0x7f) {
         ASLogDebug(@"MACMETA key, don't interpret it");

This is just a trivial adaptation of this iTerm patch:
http://swissarmyhammer.wordpress.com/2010/06/07/osx-terminal-meta-key-national-characters/
I think a proper MacVim integration would require to modify the
'macmeta' stuff, e.g. by using a string pref instead of a boolean one:

 * set macmeta=l     => left Option key is Meta
 * set macmeta=r     => right Option key is Meta
 * set macmeta=rl    => both Option keys are Meta
 * set macmeta=      => no Meta key

Thoughts?

Cheers,
:kazé

-- 
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to