1

In :imap, I see mappings like:

i  ©           *@<C-R>=AutoPairsMoveCharacter(')')<CR>
i  ¨           *@<C-R>=AutoPairsMoveCharacter('(')<CR>
i  î           *@<Esc>:call AutoPairsJump()<CR>
i  ð           *@AutoPairsToggle()

I know from the Auto Pairs page that <M-p> toggles Auto Pairs, so I can only guess that ð maps to <M-p>.

How can I get vim to display the Meta- mappings in a human readable way?

1 Answer 1

1

I don't know if these mappings are readily available anywhere but if not then you could generate them yourself. (That might be necessary anyways if the values are system dependent.) Rather than manually inserting Alt+A, Alt+B, Alt+C, ... into Vim you could use a macro to generate the values. With the macro below you put put the cursor on a character and run the macro and it will print the meta version next to the character. So p becomes p=ð

The macro is "="=\<M-^R^W>"^Mpw

Here ^R and ^W are the actual control characters Ctrl+R and Ctrl+W. ^M is inserted by hitting Enter

So start recording with qq, enter the macro as described, press q again and it's ready. Now you can type in, say, the entire lower-case alphabet on a line (characters separated by spaces), put the cursor on a, enter 26@q and you'll get the complete mapping for those characters. Here's what I get on one system from a b c d e f g h i j k l m n o p q r s t u v w x y z:

a=á b=â c=ã d=ä e=å f=æ g=ç h=è i=é j=ê k=ë l=ì m=í n=î o=ï p=ð q=ñ r=ò s=ó t=ô u=õ v=ö w=÷ x=ø y=ù z=ú

How it works:

We use the expression register = to evaluate a string like "\<M-p>" which Vim renders as if the equivalent keys were actually pressed.

  • "= : Begin entering an expression into the expression register.
  • "=\<M- : The beginning of a string like the one described above. (The separator = can be changed to any character(s) you like.)
  • ^R^W : Ctrl+R Ctrl+W copies the word under the cursor to the command line.
  • >"^M : Complete the meta-key expression and submit it to the register.
  • p : "Put" the contents of the expression register which causes the expression to be evaluated and results in the "rendered" character we're looking for.
  • w : Go to the next word (character).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.