:Make command you are using is this one, then your issue may come from the fact that it was not given the
-bar attribute when it was defined. See
-bar The command can be followed by a "|" and another command.
A "|" inside the command argument is not allowed then.
Also checks for a " to start a comment.
There are other solutions, but the simplest one may be to hide
| endif from
:Make by wrapping it inside a string, and executing the latter with
autocmd BufWritePost *.c,*.cpp,*.h
\ let dir=expand('<amatch>:p:h')
\ | if filereadable(dir.'/Makefile') || filereadable(dir.'/makefile')
\ | exe 'Make > /dev/null'
\ | endif
For the complete list of commands which, like
:Make, see the
| as part of their argument, see
These commands see the '|' as their argument, and can therefore not be
followed by another Vim command:
a user defined command without the "-bar" argument |:command|