Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

On a plain Ubuntu installation (12.04 in my case) when I have no ~/.vimrc VIM does not detect syntax of .ssh/config.

Syntax highlighting works, but it does not set the correct filetype.

vi ~/.ssh/config
  :set syn?

When I do:

set syn=sshconfig

Then the syntax highlighting is as it should be.

Why isn't the filetype automatically identified? And how can it be set automatically?

share|improve this question
BTW, do others also have this problem? Or is it just me? – Erik Oct 17 '12 at 9:20
I have opened the Vim with the not existing file ~/.ssh/config and the filetype was sshconfig. I have complex settings for vim: I tried it on 11.10. The .vimrc with just the row "filetype plugin on" is not enough: it does not set the filetype for that file. – Arpad Horvath Oct 22 '12 at 22:13

Does putting the following in ~/.vimrc help?

filetype plugin on
share|improve this answer

I think the vim that comes with a plain Ubuntu installation lacks autocmd.

Install vim completely with sudo apt-get install vim and you should be set.

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.