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?
Answer
Assuming what you’ve done is created a symlink ‘~/.ssh’ to a folder named ‘ssh’ somewhere else on your system, for example ~/git/ssh, you have 2 options:
Solution A
inside ‘~/.vim/ftdetect/ssh.vim’ put the following line:
au BufNewFile,BufRead */ssh/config setf sshconfig
Solution B
Make sure that the folder which the symlink resolves to is called ‘.ssh’
The culprit file ⇒ /usr/share/vim/vim73/filetype.vim:
au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
Attribution
Source : Link , Question Author : Erik , Answer Author : mullikine