Martin
Martin

Reputation: 202

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:

 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. However when I type:

set makeprg=yuml\ -i\ %\ -o\ %<\.pdf\ -f\ pdf\ &\ sleep\ 1\;\ evince\ %<.pdf\ &

manually in vim, the command does work.

What am I doing wrong here?

Thanks,

Martin


Edit: I forgot to explicitly define the yuml filetype. So what I needed to do was add the following line to the .vimrc file:

au BufRead,BufNewFile *.yuml set filetype=yuml

Upvotes: 0

Views: 214

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172540

I don't know what exactly is wrong, but in a scripted autocmd, I would skip the escaping issue and use :let instead:

: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?

Upvotes: 4

Related Questions