Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set a key mapping in vim. I know that <c-j> means Control-J. What is the text representation of the capslock key? I tried <capslock> but that does not work.

Is there a list of these representations somewhere?

share|improve this question
    
Type :help key-notation into Vim for the list of special keys Vim understands. –  Chris Johnsen Mar 14 '12 at 6:31
    
@KevinReid You changed the question so drastically that I get downvotes for my then-correct answer — I'd suggest lampShade accepts it and moves on, or eventually deletes the whole question. –  slhck Mar 14 '12 at 9:52
add comment

3 Answers

Note: This only answers the original question, which was then changed to specify the exact problem the OP had. Vim won't ever see the Caps Lock key. You can only remap the Caps Lock key to something else in OS X, and then use standard key mappings in vim.

See here for more info: Using Caps Lock as Esc in Mac OS X


Probably best like this:

That's the symbol on Mac keyboards. It's called "UPWARDS WHITE ARROW FROM BAR" and its Unicode key is 21EA.

For a list of common OS X key symbol, see: The Macintosh Biblioblog: Special Key Symbols


Ctrl in OS X is actually represented by the "UP ARROWHEAD" (Unicode 2303). The c- notation is only common in Emacs, the editor that probably made the Control keyboard shortcuts popular.

For more info, see:

share|improve this answer
    
I'm trying to set a key mapping in vim. –  lampShade Mar 12 '12 at 20:48
5  
@lampShade: That's sort of the VERY FIRST thing you want to say... –  Ignacio Vazquez-Abrams Mar 12 '12 at 20:53
1  
@lampShade: You should've included this in the question; right now it is as vague as possible. And you cannot map CapsLock in term-based vim, since it is never actually sent to the program. Vim only sees its effects. –  grawity Mar 12 '12 at 20:55
1  
That's not possible without hacks. OS X will translate the caps lock key before it's passed to the application. vim would never see that. What you could try though – not repeating this here: Using Caps Lock as Esc in Mac OS X @lam –  slhck Mar 12 '12 at 20:55
    
yeah, I should have said that first. I mistakenly thought that this was a "mac thing" but its a "vim thing" –  lampShade Mar 12 '12 at 21:06
add comment

Is it truly necessary to do this? If in the instructions show text in upper case, this should suffice.

share|improve this answer
add comment

You cannot map Caps-Lock in Vim—neither in console/terminal based Vim, nor the GUI based gVim, because Vim simply cannot "see" when that key is pressed.

If you really want to do this, you will probably have to find out how to get your OS to change the meaning of Caps-Lock to something else that Vim can see, but you will lose it for Caps-Lock.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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