0

I don't understand how to make $* to work when I set &makeprg. For example, if I set &makeprg = 'pandoc --from=markdown --output %:p:r:S.$* -- %:p:S' and I run make html, then the $* is not substituted with html. I am working with Vim 9.1071.

1 Answer 1

1

If I do:

let &makeprg = 'pandoc --from=markdown --output %:p:r:S.$* -- %:p:S' 

Then:

:make html 

generate the command:

pandoc --from=markdown --output "myfolder/myfile".html -- "myfolder/myfile" 

The problem is with the %:p:r:S.$* part. The the :S that escape the path for the shell is actually quoting the path moving the argument (i.e. html) outside the quote.

You get "myfolder/myfile".html where you probably like to have "myfolder/myfile.html"

I would not use the shell escape (i.e. :S) and quote the path explicitly: "%:p:r.$*".

Maybe you would like to do:

let &makeprg = 'pandoc --from=markdown --output "%:p:r.$*" -- %:p:S' 

that generates:

pandoc --from=markdown --output "myfolder/myfile.html" -- "myfolder/myfile" 
3
  • 1
    I’m having a really hard time discerning what’s different in this answer from the question Commented Feb 15 at 1:06
  • I'll improve my explanations :-) Commented Feb 15 at 3:33
  • 1
    Interesting: with "foo".html the shell eventually sends just foo.html to the external command, so I’m not sure the diagnosis of the problem is correct. But OP has indicated the solution is, so that’s very interesting indeed… Commented Feb 15 at 22:08

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.