[英]Trying to set makeprg in vim for yuml filetypes, works manually, not working in vimrc
I'm trying to get the following entry working in my .vimrc: 我正在尝试在我的.vimrc中运行以下条目:
autocmd FileType yuml set makeprg=yuml\ -i\ %\ -o\ %<\.pdf\ -f\ pdf\ &\ sleep\ 1\;\ evince\ %<.pdf\ &
It doesn't work and whenever I type :make, it uses some default options from the yuml utility. 它不起作用,每当我输入:make时,它都会使用yuml实用程序的一些默认选项。 However when I type:
但是当我键入:
set makeprg=yuml\ -i\ %\ -o\ %<\.pdf\ -f\ pdf\ &\ sleep\ 1\;\ evince\ %<.pdf\ &
manually in vim, the command does work. 在vim中手动执行该命令即可。
What am I doing wrong here? 我在这里做错了什么?
Thanks, 谢谢,
Martin 马丁
Edit: I forgot to explicitly define the yuml filetype. 编辑:我忘了明确定义yuml文件类型。 So what I needed to do was add the following line to the .vimrc file:
所以我需要做的是将以下行添加到.vimrc文件中:
au BufRead,BufNewFile *.yuml set filetype=yuml
I don't know what exactly is wrong, but in a scripted autocmd, I would skip the escaping issue and use :let
instead: 我不知道到底是什么错,但是在脚本化的autocmd中,我将跳过转义问题,而使用
:let
代替:
:autocmd FileType yuml let &makeprg = 'yuml -i % -o %<.pdf -f pdf & sleep 1; evince %<.pdf &'
Also, check that the filetype is correctly set with :set ft?
另外,用
:set ft?
检查文件类型是否正确设置:set ft?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.