vim-dispatch icon indicating copy to clipboard operation
vim-dispatch copied to clipboard

difference in pipe escaping between :make and :Make

Open aaronjensen opened this issue 11 years ago • 6 comments

I'm trying to do this:

autocmd BufNewFile,BufRead *_spec.rb compiler rspec | set makeprg=`([\ -e\ .zeus.sock\ ]&&echo\ zeus)\ \\\|\\\|\ ([\ -e\ Gemfile\ ]&&echo\ bundle\ exec)`\ rspec

This works fine w/ :make but :Make I end up with

/bin/bash: command substitution: line 0: syntax error near unexpected token `\|\|'
/bin/bash: command substitution: line 0: `([ -e .zeus.sock ]&&echo zeus) \|\| ([ -e Gemfile ]&&echo bundle exec)'

aaronjensen avatar Apr 03 '13 05:04 aaronjensen

Oh wow, so unescaped pipes in 'makeprg' "leak out" in to Vimscript? Gross.

This particular example can be rewritten to use if, so I don't consider this high priority. It's legitimate to want to pipe things in 'makeprg' though, so I do want to get this fixed.

tpope avatar Apr 04 '13 06:04 tpope

Good call. So used to &&/|| for one liners, got tunnel vision. Thanks.

aaronjensen avatar Apr 04 '13 06:04 aaronjensen

Keep an eye out for other oddities. For example, normally anywhere you can use a |, you can comment with ", but that's not true with 'makeprg'.

tpope avatar Apr 04 '13 06:04 tpope

set makeprg=latexmk\ -gg\ -interaction=nonstopmode\ -file-line-error\ \\\|\ grep\ -P\ ':\\d{1,5}:\ '

I am getting:

  || Latexmk: -P bad option
  || 
  || Latexmk: Bad options specified
  || Use
  ||    latexmk -help
  || to get usage information

Any quick fixes?

Miesco avatar Apr 26 '16 17:04 Miesco

Your use of grep suggests what you really want is a proper 'errorformat' that matches the lines in question.

tpope avatar Apr 26 '16 22:04 tpope

Similar problem escaping "!" in make arguments. Discovered via ack.vim but reproducible with vim-dispatch alone.

Using ack in command line:

$ ack 'foo (?!==)='
content.txt:1:1:foo = bar

In vim:

:let &makeprg = 'ack -s -H --nopager --nocolor --nogroup --column'
:set errorformat=%f:%l:%c:%m
:make 'foo (?!==)=

With make, quickfix shows the same results as ack in the shell. With Make, the "!" is interpreted as a substitution and the command does not work. It does work with the exclamation mark escaped, though.

jpassaro avatar Mar 08 '17 22:03 jpassaro