Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?
  >syntax=conf

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: 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. –  Arpad Horvath Oct 22 '12 at 22:13
add comment

2 Answers 2

Does putting the following in ~/.vimrc help?

filetype plugin on
share|improve this answer
add comment

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
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.