Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently have my capslock key bound to [compose] using xmodmap. Compose is good when typing scientific stuff, as I can quickly write things like 275°K.

But it's not useful when programming. When I use vim, I'd like to have the [esc] mapped to capslock, while maintaining the [compose] functionality elsewhere. In other words, I don't want to use xmodmap to do the mapping, I want to do it in vim itself.

share|improve this question

migrated from Feb 10 '12 at 9:13

This question came from our site for professional programmers interested in conceptual questions about software development.

It's always been my understanding that the Kelvin isn't a scale of degrees, so 275°K should actually be 275K. No, this isn't relevant to the actual question, just your example. – mkomitee Feb 10 '12 at 13:18
True! I'd never realised. Well, I don't think I've ever actually written anything in Kelvin, except perhaps something in a first year physics course. So let's just call it 2°C :) – naught101 Feb 11 '12 at 0:52
up vote 1 down vote accepted

Unfortunately Vim/gVim cannot "see" when you press the compose key—just like it can not really "see" when you are only pressing shift, control, alt, or meta without pressing another key in combination—so you cannot change its meaning in just Vim.

share|improve this answer
Hrm. I guess it doesn't matter about the meaning of the key, as that the compose key maps to the "return to normal mode" function. But if you're right, then this probably isn't possible either... – naught101 Feb 11 '12 at 4:12
The best I can suggest is to map it to a key that Vim can "see," but isn't usually used for anything else, then see if you can get your window manager to contextually bind the key. It's a kluge, but I've done similar in the past using FVWM2 and some other utilities. – Heptite Feb 11 '12 at 6:07
Hrm. I ended up giving up and just mapping capslock to esc, and esc to compose. Probably a more globally sensible set-up anyway. Thanks for you answer! – naught101 Feb 11 '12 at 6:56

Your Answer


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.