如果加载了特定文件类型的文件,我可以使用autocmd使我的cmd运行.例如对于python:
autocmd FileType python make me happy with python
Run Code Online (Sandbox Code Playgroud)
但是,如果加载的文件不是特定类型,有没有办法让我的cmd运行?就像是:
autocmd FileType !python make me happy without python
Run Code Online (Sandbox Code Playgroud)
上面的示例不起作用,autocmd!将删除autocmd.
有什么建议?谢谢.
有几种可能性:
*模式并仅在检查文件类型的if条件内调用代码(类似于此):
autocmd Filetype * if &ft!="python"|put your code here|endif:autocmd FileType [^p],[^p][^y],[^p][^y][^t],[^p][^y][^t][^h],[^p][^y][^t][^h][^o],[^p][^y][^t][^h][^o][^n] :put your code here(最后一部分未经测试,应说明,为什么通常使用任何其他可能性).