Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

My Mac has a British keyboard layout and the # symbol is entered with option-3, instead of shift-3 as with the US layout. This arrangement, though odd, works fine most of the time. However, when trying to edit a file with vim in a terminal, typing option-3 just takes vim out of edit mode.

I use # often for comments in scripting languages and for pre-processor directives in C.

How do I type #?

share|improve this question

migrated from stackoverflow.com Aug 23 '09 at 8:03

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

Another option: Ctrl-K, Shift-N, b

share|improve this answer
    
Yes. That works. – Will Harris Aug 21 '09 at 18:30
    
I have a mac with UK keyboard too, but ctrl and K gives me ? Shift-N and N and not sure what 'b; means – rtacconi Dec 15 '11 at 9:48
    
@rtacconi "?" means that Vim is waiting for you to type the next two characters of the digraph, "Nb" in this case. :help digraph . – Juliano Dec 15 '11 at 18:26

In Terminal's settings, un-check 'Use option as meta key'. It's under the 'Settings' tab's 'Keyboard' pane.

share|improve this answer

Does Ctrl-V, Option-3 work?

share|improve this answer
    
No. I just get ^[3 ("\x1b3"). – Will Harris Aug 21 '09 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .