Saturday, June 19, 2010

Getting the exit code from make in Vim

Just answered the question on SO and I think the final trick is worth documenting here. The problem is how to get after :make exit code of the make itself. As it is wrapped by VIM, it gets lost in the pipe: :echo v:shell_error always shows 0 (:h v:shell_error).

The bash-specific trick is:

:set shellpipe=2>&1\ \|\ tee\ %s;exit\ \${PIPESTATUS[0]}

The magic is in the ;exit ${PIPESTATUS[0]}.

man bash (search for PIPESTATUS) and :h 'shellpipe' (check the %s) for more info.

Monday, June 07, 2010

[link] VIM + ctags

Nothing new, yet useful to have for reference.

So StackOverflow.com can be useful at times.