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

Here is a small vimrc snippet that I was trying to use on my Mac

function SetCommonDefaults()
  " Set line numbers
  set nu

autocmd FileType cpp call SetCommonDefaults()

What I expect this to do is, to display line numbers when I open up files of type cpp for editing. While this works fine in Linux, it doesn't work for me in Mac. I am not using MacVim, but the standard vim binary that comes pre-loaded.

share|improve this question

Do you have filetype on somewhere in your ~/.vimrc?

Anyway, filetype specific settings should be placed in a separate file:


without autocmds. So, basically, only line 3 of your example.

share|improve this answer

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.