Eri*_*rik 2 ssh vim syntax-highlighting
vi ~/.ssh/config
:set syn?
>syntax=conf
Run Code Online (Sandbox Code Playgroud)
当我做:
set syn=sshconfig
Run Code Online (Sandbox Code Playgroud)
然后语法高亮就是它应该的样子。
为什么不能自动识别文件类型?以及如何自动设置?
假设您所做的是创建了一个符号链接 '~/.ssh' 到系统上其他位置名为 'ssh' 的文件夹,例如 ~/git/ssh,您有两个选项:
在 '~/.vim/ftdetect/ssh.vim' 中放置以下行:
au BufNewFile,BufRead */ssh/config setf sshconfig
Run Code Online (Sandbox Code Playgroud)
确保符号链接解析到的文件夹名为“.ssh”
罪魁祸首档案?/usr/share/vim/vim73/filetype.vim:
au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
Run Code Online (Sandbox Code Playgroud)