Script:3479
Talk0
1,599pages on
this wiki
this wiki
Revision as of 15:41, December 6, 2011 by Fritzophrenic (Talk | contribs)
Use this page to discuss script 3479 makebg: shell script to perform make in the background
- Add constructive comments, bug reports, or discuss improvements (see the guideline).
- Do not document the script here (the author should do that on vim.org).
- This page may be out of date: check the script's vim.org page above, and its release notes.
Suggestion
Edit
This is a really useful little script, but personally, I don't want to see any build output unless the build fails. As such, how about changing the script like this?
makeef="${3:-vimbuild.err}"
makeef="${makeef#$PWD/}" # remove path, if present
makeprg="${2:-make}"
server="${1:-GVIM}"
{
tempfile=`tempfile`
> "$makeef";
echo '-----------------------------------------' >> ".$makeef"
date >> ".$makeef"
echo '-----------------------------------------' >> ".$makeef"
# run make, saving all output to a file, and recording exit code.
exec 3<> $tempfile
$makeprg >&3 2>&1
rc=$?
exec 3>&-
# sed removes some words to prevent vim from misparsing a filename
sed -e's/In file included from //' $tempfile >> ".$makeef";
echo -e '\n\n' >> ".$makeef"
cat "$makeef" >> ".$makeef"
mv ".$makeef" "$makeef";
if [ $rc -eq 0 ]
then
vim --servername "$server" --remote-send \
'<Esc>:redraw | :echo "Build Successful"<CR>'
else
vim --servername "$server" --remote-send \
"<Esc>:cgetfile $PWD/$makeef |copen<CR><CR>"
fi
} &
Now, a successful will display "Build Successful", whereas a failing build will display the quickfix error window.
See also
Edit
- script#3431 generic async facility; provides an "AsyncMake" command
- Our tip on ways to execute asynchronous commands on your own.