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.

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

function SetCommonDefaults()
  " Set line numbers
  set nu
endfunction

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

1 Answer 1

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

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

~/.vim/after/ftplugin/cpp.vim

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

share|improve this answer

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.