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.

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
add comment

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

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

3 Answers

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
add comment

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

share|improve this answer
add comment

Does Ctrl-V, Option-3 work?

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