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?

  • BTW, do others also have this problem? Or is it just me?
    – Erik
    Commented Oct 17, 2012 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: github.com/horvatha/vimrc 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. Commented Oct 22, 2012 at 22:13

2 Answers 2


Does putting the following in ~/.vimrc help?

filetype plugin on

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.

You must log in to answer this question.

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